/* ═══════════════════════════════════════════════════════════════
   DCA Signal Report — Redesigned CSS
   Premium dark-mode dashboard with glassmorphism, micro-animations,
   and collapsible detail rows.
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg: #060910;
  --bg-gradient: linear-gradient(135deg, #060910 0%, #0a0f1a 50%, #060910 100%);
  --surface: rgba(13, 17, 23, 0.85);
  --surface-solid: #0d1117;
  --glass: rgba(13, 17, 23, 0.6);
  --glass-border: rgba(255, 255, 255, 0.06);
  --border: #1e2530;
  --border-subtle: rgba(30, 37, 48, 0.5);
  --text: #c9d1d9;
  --text-bright: #e6edf3;
  --muted: #586069;
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.15);
  --yellow: #f59e0b;
  --yellow-glow: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.1);
  --blue: #38bdf8;
  --blue-glow: rgba(56, 189, 248, 0.1);
  --magenta: #e879f9;
  --accent: #00ffa3;
  --accent-glow: rgba(0, 255, 163, 0.08);
  --orange: #fb923c;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --font-display: 'Syne', -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'SF Mono', monospace;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --transition-fast: 0.15s ease;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Light Mode ────────────────────────────────────────────── */
:root.light {
  --bg: #f4f6f9;
  --bg-gradient: linear-gradient(135deg, #f4f6f9 0%, #e8ecf1 50%, #f4f6f9 100%);
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.06);
  --border: #d8dee4;
  --border-subtle: rgba(208, 215, 222, 0.5);
  --text: #24292f;
  --text-bright: #1b1f23;
  --muted: #656d76;
  --green: #1a7f37;
  --green-glow: rgba(26, 127, 55, 0.08);
  --yellow: #9a6700;
  --yellow-glow: rgba(154, 103, 0, 0.06);
  --red: #cf222e;
  --red-glow: rgba(207, 34, 46, 0.06);
  --blue: #0969da;
  --blue-glow: rgba(9, 105, 218, 0.06);
  --magenta: #8250df;
  --accent: #1a7f37;
  --accent-glow: rgba(26, 127, 55, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-gradient);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 24px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle grid overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 255, 163, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(56, 189, 248, 0.015) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

:root.light body::before {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(26, 127, 55, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(9, 105, 218, 0.02) 0%, transparent 50%);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.header-left h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-bright);
  line-height: 1.1;
}

.header-left h1 .accent {
  color: var(--accent);
}

.header-left h1 .version {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 400;
  vertical-align: super;
  margin-left: 4px;
  font-family: var(--font-mono);
}

.header-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.timestamp {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.timestamp-relative {
  color: var(--accent);
  font-weight: 600;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-glow);
  border: 1px solid rgba(0, 255, 163, 0.2);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

:root.light .week-badge {
  background: rgba(26, 127, 55, 0.08);
  border-color: rgba(26, 127, 55, 0.25);
}

.theme-toggle {
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--accent-glow);
  border-color: rgba(0, 255, 163, 0.3);
  color: var(--accent);
  transform: rotate(15deg);
}

.theme-toggle .moon-icon { display: block; }
.theme-toggle .sun-icon { display: none; }
:root.light .theme-toggle .moon-icon { display: none; }
:root.light .theme-toggle .sun-icon { display: block; }

/* ═══════════════════════════════════════════════════════════════
   SUMMARY CARDS — Glassmorphism
   ═══════════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.04;
  pointer-events: none;
}

.stat-card.buy::before { background: var(--green); }
.stat-card.buy::after { background: var(--green); }
.stat-card.sell::before { background: var(--red); }
.stat-card.sell::after { background: var(--red); }
.stat-card.watch::before { background: var(--yellow); }
.stat-card.watch::after { background: var(--yellow); }
.stat-card.total::before { background: var(--blue); }
.stat-card.total::after { background: var(--blue); }

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
  opacity: 0.8;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card.buy .stat-value { color: var(--green); }
.stat-card.sell .stat-value { color: var(--red); }
.stat-card.watch .stat-value { color: var(--yellow); }
.stat-card.total .stat-value { color: var(--blue); }

.stat-label {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   FILTER BAR — Pill / Chip Style
   ═══════════════════════════════════════════════════════════════ */
.filter-bar {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 4px;
}

.filter-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
}

/* Pill-style filter chips */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.filter-pill input[type="checkbox"] {
  display: none;
}

.filter-pill .pill-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: all var(--transition);
  cursor: pointer;
}

.filter-pill .pill-label:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-pill input:checked + .pill-label {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

:root.light .filter-pill input:checked + .pill-label {
  background: rgba(26, 127, 55, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* Search input in filter bar */
.filter-search {
  margin-left: auto;
  position: relative;
}

.filter-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.filter-search input {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px 6px 32px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  width: 180px;
  transition: all var(--transition);
  outline: none;
}

.filter-search input:focus {
  border-color: var(--accent);
  width: 220px;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-search input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* Decision filter (inline in filter bar) */
.filter-decisions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Results counter */
.results-counter {
  font-size: 0.65rem;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   INDICATOR GUIDE — Collapsible
   ═══════════════════════════════════════════════════════════════ */
.guide-toggle {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.guide-toggle-btn {
  width: 100%;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition);
}

.guide-toggle-btn:hover {
  color: var(--accent);
}

.guide-toggle-btn .chevron {
  transition: transform var(--transition);
  font-size: 0.6rem;
}

.guide-toggle.open .guide-toggle-btn .chevron {
  transform: rotate(90deg);
}

.guide-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 20px;
}

.guide-toggle.open .guide-content {
  max-height: 400px;
  padding: 0 20px 16px;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.guide-section {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 2;
}

.guide-section b {
  color: var(--accent);
}

/* ── Legend (compact) ──────────────────────────────────────── */
.legend {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-dots-info {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════
   TABLE — Simplified with expandable detail rows
   ═══════════════════════════════════════════════════════════════ */
.table-wrapper {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

/* Table head */
thead th {
  background: var(--surface-solid);
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

thead th:first-child { padding-left: 20px; }

thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

thead th.sortable:hover { color: var(--accent); }

thead th.sortable .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.3;
  font-size: 0.65rem;
}

thead th.sortable.sort-asc .sort-indicator::after {
  content: '▲';
  opacity: 1;
  color: var(--accent);
}

thead th.sortable.sort-desc .sort-indicator::after {
  content: '▼';
  opacity: 1;
  color: var(--accent);
}

thead th.sortable:not(.sort-asc):not(.sort-desc) .sort-indicator::after {
  content: '▲';
}

:root.light thead th {
  background: rgba(0, 0, 0, 0.02);
}

/* Group Header Row */
tr.group-header td {
  background: var(--surface-solid);
  padding: 10px 20px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  color: var(--blue);
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

:root.light tr.group-header td {
  background: rgba(0, 0, 0, 0.03);
}

/* Data Rows */
tbody tr:not(.group-header):not(.reason-row):not(.detail-row) td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

tbody tr:not(.group-header):not(.reason-row):not(.detail-row) td:first-child {
  padding-left: 20px;
}

tbody tr:not(.group-header):not(.reason-row):not(.detail-row):hover td {
  background: rgba(255, 255, 255, 0.02);
}

:root.light tbody tr:not(.group-header):not(.reason-row):not(.detail-row):hover td {
  background: rgba(0, 0, 0, 0.02);
}

/* Clickable row cursor */
tbody tr[data-ticker] {
  cursor: pointer;
}

/* Reason Row (kept for compatibility) */
tr.reason-row td {
  padding: 0 20px 12px;
  font-size: 0.72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  line-height: 1.7;
  font-family: var(--font-body);
}

tr.reason-row td b {
  color: var(--text);
  font-weight: 600;
}

/* ── Detail Row (Expandable) ─────────────────────────────── */
tr.detail-row {
  display: none;
}

tr.detail-row.open {
  display: table-row;
}

tr.detail-row td {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px 0 4px;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-item {
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  transition: all var(--transition-fast);
}

.detail-item:hover {
  border-color: var(--border);
}

.detail-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.detail-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-bright);
}

.detail-value.fired {
  color: var(--green);
}

.detail-value.danger {
  color: var(--red);
}

.detail-value.warn {
  color: var(--yellow);
}

/* Reason inside the detail row */
.detail-reason {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.7;
}

.detail-reason b {
  color: var(--text);
  font-weight: 600;
}

/* ── Row Colors ───────────────────────────────────────────── */
tr.row-buy td { background: var(--green-glow); }
tr.row-buy.reason-row td,
tr.row-buy.detail-row td { background: var(--green-glow); }

tr.row-forced td { background: rgba(232, 121, 249, 0.04); }
tr.row-forced.reason-row td,
tr.row-forced.detail-row td { background: rgba(232, 121, 249, 0.04); }

tr.row-sell td { background: var(--red-glow); }
tr.row-sell.reason-row td,
tr.row-sell.detail-row td { background: var(--red-glow); }

tr.row-review td { background: var(--yellow-glow); }
tr.row-review.reason-row td,
tr.row-review.detail-row td { background: var(--yellow-glow); }

tr.row-done td { background: var(--blue-glow); }
tr.row-done.reason-row td,
tr.row-done.detail-row td { background: var(--blue-glow); }

tr.row-watch td { background: rgba(245, 158, 11, 0.03); }
tr.row-watch.reason-row td,
tr.row-watch.detail-row td { background: rgba(245, 158, 11, 0.03); }

tr.row-hold td { background: transparent; }

/* ── Cell Styles ──────────────────────────────────────────── */
.ticker-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-bright);
  letter-spacing: 0.04em;
}

.mkt-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.52rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--blue-glow);
  color: var(--blue);
  font-family: var(--font-mono);
  vertical-align: middle;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.pos {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.neg {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ── Score Display ─────────────────────────────────────────── */
.score-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
}

.score-display .score-num {
  color: var(--text-bright);
}

.score-display .score-max {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.7rem;
}

.score-high .score-num { color: var(--green); }
.score-mid .score-num { color: var(--yellow); }

/* ── Indicator Dots ───────────────────────────────────────── */
.dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 0.56rem;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 2px;
  cursor: default;
  transition: transform var(--transition-fast);
}

.dot:hover {
  transform: scale(1.15);
}

.dots-separator {
  color: var(--border);
  margin: 0 3px;
  font-size: 0.7rem;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-buy {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-forced {
  background: rgba(232, 121, 249, 0.15);
  color: var(--magenta);
  border: 1px solid rgba(232, 121, 249, 0.3);
}

.badge-sell {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-review {
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-done {
  background: rgba(56, 189, 248, 0.1);
  color: var(--blue);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-watch {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-hold {
  background: rgba(88, 96, 105, 0.12);
  color: var(--muted);
  border: 1px solid rgba(88, 96, 105, 0.2);
}

.badge-na {
  background: rgba(88, 96, 105, 0.08);
  color: var(--muted);
  border: 1px solid rgba(88, 96, 105, 0.15);
}

/* ── Decision Cell ────────────────────────────────────────── */
.decision-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Action buttons (record buy, undo, historic) */
.record-buy-btn,
.undo-buy-btn,
.historic-ticker-btn,
.historic-ticker-btn-active {
  border-radius: 5px;
  padding: 4px 6px;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.record-buy-btn {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.record-buy-btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  transform: scale(1.1);
}

.undo-buy-btn {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--red);
}

.undo-buy-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
}

.historic-ticker-btn {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--muted);
}

.historic-ticker-btn:hover {
  background: var(--blue-glow);
  border-color: var(--blue);
  color: var(--blue);
}

.historic-ticker-btn-active {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.historic-ticker-btn-active:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}

.record-buy-btn:active,
.undo-buy-btn:active,
.historic-ticker-btn:active,
.historic-ticker-btn-active:active {
  transform: scale(0.92);
}

/* ═══════════════════════════════════════════════════════════════
   EXPAND ARROW
   ═══════════════════════════════════════════════════════════════ */
.expand-arrow {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: transform var(--transition), color var(--transition-fast);
  font-size: 0.7rem;
  margin-left: 4px;
}

tr.expanded .expand-arrow {
  transform: rotate(90deg);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */
.footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.footer-left {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  line-height: 2;
}

.strategy-box {
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-xs);
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 2;
}

.strategy-box b { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   FLOATING ACTION BUTTON (local dev only)
   ═══════════════════════════════════════════════════════════════ */
.fab-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: none; /* JS sets to flex on localhost */
}

.fab-container.visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 255, 163, 0.3);
  transition: all var(--transition-spring);
  background: linear-gradient(135deg, var(--accent) 0%, #00cc82 100%);
  color: var(--bg);
}

.fab:hover:not(:disabled) {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 28px rgba(0, 255, 163, 0.4);
}

.fab:active:not(:disabled) {
  transform: scale(0.95);
}

.fab:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.fab .fab-icon {
  transition: opacity var(--transition-fast);
}

.fab.loading .fab-icon { display: none; }
.fab .fab-spinner { display: none; }
.fab.loading .fab-spinner {
  display: block;
  animation: spin 1s linear infinite;
}

:root.light .fab {
  background: linear-gradient(135deg, var(--green) 0%, #15803d 100%);
  box-shadow: 0 4px 20px rgba(26, 127, 55, 0.25);
}

:root.light .fab:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(26, 127, 55, 0.35);
}

/* ═══════════════════════════════════════════════════════════════
   SCANNING INDICATOR
   ═══════════════════════════════════════════════════════════════ */
.scanning-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--green), var(--accent));
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  z-index: 9999;
  display: none;
}

.scanning-indicator.active { display: block; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   LOADING MODAL
   ═══════════════════════════════════════════════════════════════ */
.loading-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 9, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

:root.light .loading-modal {
  background: rgba(244, 246, 249, 0.92);
}

.loading-modal.active { display: flex; }

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* Hourglass */
.hourglass {
  width: 56px;
  height: 56px;
  position: relative;
  animation: hourglass-spin 2s linear infinite;
}

.hourglass::before, .hourglass::after {
  content: '';
  position: absolute;
  background: var(--accent);
}

.hourglass::before {
  width: 56px; height: 5px; top: 0;
  border-radius: 3px 3px 0 0;
  animation: hourglass-top 2s linear infinite;
}

.hourglass::after {
  width: 56px; height: 5px; bottom: 0;
  border-radius: 0 0 3px 3px;
  animation: hourglass-bottom 2s linear infinite;
}

.hourglass .glass {
  position: absolute;
  width: 36px; height: 44px;
  left: 10px; top: 5px;
  background: linear-gradient(180deg,
    transparent 0%, rgba(0,255,163,0.1) 20%,
    rgba(0,255,163,0.2) 50%, rgba(0,255,163,0.1) 80%, transparent 100%
  );
  clip-path: polygon(20% 0%, 80% 0%, 100% 50%, 80% 100%, 20% 100%, 0% 50%);
}

.hourglass .sand-top {
  position: absolute;
  width: 28px; height: 18px;
  left: 14px; top: 7px;
  background: var(--accent); opacity: 0.8;
  clip-path: polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%);
  animation: sand-fall 2s linear infinite;
}

.hourglass .sand-bottom {
  position: absolute;
  width: 28px; height: 18px;
  left: 14px; bottom: 7px;
  background: var(--accent); opacity: 0;
  clip-path: polygon(0% 0%, 100% 0%, 75% 100%, 25% 100%);
  animation: sand-pile 2s linear infinite;
}

.hourglass .stream {
  position: absolute;
  width: 3px; height: 30px;
  left: 26px; top: 25px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  opacity: 0;
  animation: sand-stream 2s linear infinite;
}

@keyframes hourglass-top { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes hourglass-bottom { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes sand-fall { 0% { height: 18px; opacity: 0.8; } 50% { height: 4px; opacity: 0.3; } 100% { height: 18px; opacity: 0.8; } }
@keyframes sand-pile { 0%, 30% { opacity: 0; height: 4px; } 60%, 100% { opacity: 0.8; height: 18px; } }
@keyframes sand-stream { 0%, 20% { opacity: 0; } 30%, 70% { opacity: 0.8; } 80%, 100% { opacity: 0; } }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.03em;
}

.loading-subtext {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 380px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.info { border-color: var(--blue); }

.toast-icon { font-size: 1.1rem; }

.toast-message {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
  line-height: 1.5;
}

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  margin-left: auto;
  transition: color var(--transition-fast);
}

.toast-close:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   HISTORIC SIGNALS MODAL
   ═══════════════════════════════════════════════════════════════ */
.historic-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
}

.historic-modal.active { display: flex; }

.historic-modal-content {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.historic-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.historic-modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
  margin: 0;
}

.historic-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.historic-modal-close:hover {
  background: var(--surface-solid);
  color: var(--text);
}

.historic-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

.historic-loading {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.historic-signal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.historic-signal-item {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.historic-signal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.historic-signal-ticker {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-bright);
}

.historic-signal-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
}

.historic-signal-reason {
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.5;
}

.historic-signal-indicators {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.historic-signal-indicator {
  background: var(--accent-glow);
  border: 1px solid rgba(0, 255, 163, 0.25);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 600;
}

.historic-no-signals {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.historic-week-info {
  text-align: center;
  padding: 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(0, 255, 163, 0.2);
  border-radius: var(--radius-xs);
  margin-bottom: 14px;
  font-size: 0.7rem;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ═══════════════════════════════════════════════════════════════
   NO RESULTS
   ═══════════════════════════════════════════════════════════════ */
.no-results-message {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    gap: 12px;
  }

  .header-right {
    align-items: flex-start;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .filter-divider {
    display: none;
  }

  .filter-search {
    margin-left: 0;
    width: 100%;
  }

  .filter-search input {
    width: 100%;
  }

  .filter-search input:focus {
    width: 100%;
  }

  .footer {
    grid-template-columns: 1fr;
  }

  .fab-container {
    bottom: 16px;
    right: 16px;
  }

  .fab {
    width: 48px;
    height: 48px;
  }

  /* Allow horizontal scroll for table */
  .table-wrapper {
    border-radius: var(--radius-sm);
  }

  table {
    min-width: 700px;
  }
}

@media (max-width: 480px) {
  .header-left h1 {
    font-size: 1.4rem;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .legend {
    gap: 8px;
  }

  .legend-dots-info {
    display: none;
  }
}
