/* ═══════════════════════════════════════════
   Capitol Trades — Dashboard Styles
   ═══════════════════════════════════════════ */

:root {
  --bg-body: #08090d;
  --bg-surface: #11131a;
  --bg-elevated: #191c26;
  --bg-hover: #1e2130;
  --border-subtle: #1a1e2a;
  --border: #262b3a;
  --border-focus: #c9a54e;

  --text-primary: #e2e4ea;
  --text-secondary: #7a8099;
  --text-muted: #454b60;

  --accent: #c9a54e;
  --accent-hover: #d6b560;
  --accent-dim: rgba(201, 165, 78, 0.15);

  --purchase: #34d399;
  --purchase-bg: rgba(52, 211, 153, 0.10);
  --sale: #f87171;
  --sale-bg: rgba(248, 113, 113, 0.10);
  --exchange: #60a5fa;
  --exchange-bg: rgba(96, 165, 250, 0.10);

  --radius: 6px;
  --radius-lg: 10px;

  --font-display: 'Cormorant', Georgia, serif;
  --font-body: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}


/* ── Reset ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-body);
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, #151a28 0%, transparent 70%);
  min-height: 100vh;
  line-height: 1.5;
}


/* ── Header ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 9, 13, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--accent);
}

.header-line {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  opacity: 0.35;
}


/* ── Tabs ── */

.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab.active {
  color: var(--accent);
  background: var(--accent-dim);
}


/* ── Main ── */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}


/* ── Tab Panels ── */

.tab-panel {
  display: none;
  animation: fadeUp 0.25s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── Panel Head ── */

.panel-head {
  margin-bottom: 20px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.panel-desc {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  max-width: 540px;
}


/* ══════════════════════════════════════════
   Tab 1 — Trade Cards
   ══════════════════════════════════════════ */

.trades-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-input,
.filter-select {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input { width: 120px; }

.filter-input::placeholder { color: var(--text-muted); }

.filter-input:focus,
.filter-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%237a8099' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}


/* ── Trade Card ── */

.trades-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trade-card {
  display: flex;
  align-items: stretch;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  transition: background 0.15s, border-color 0.15s;
}

.trade-card:hover {
  background: var(--bg-hover);
}

.trade-card.purchase { border-left-color: var(--purchase); }
.trade-card.sale     { border-left-color: var(--sale); }
.trade-card.exchange { border-left-color: var(--exchange); }

.tc-body {
  flex: 1;
  min-width: 0;
}

.tc-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.tc-ticker,
.ticker-link {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  text-decoration: none;
  min-width: 48px;
}

.tc-ticker:hover,
.ticker-link:hover {
  color: var(--accent);
}

.tc-atype {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tc-spacer { flex: 1; min-width: 12px; }

.tc-amount {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.tc-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.tc-bottom {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: baseline;
}

.tc-asset {
  color: var(--text-secondary);
}

.tc-sep {
  color: var(--text-muted);
}

.tc-desc {
  color: var(--text-muted);
}

.tc-link {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s;
  margin-left: 8px;
  align-self: center;
}

.tc-link:hover {
  color: var(--accent);
}


/* ── Badges ── */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-purchase {
  color: var(--purchase);
  background: var(--purchase-bg);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.18);
}

.badge-sale {
  color: var(--sale);
  background: var(--sale-bg);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.18);
}

.badge-exchange {
  color: var(--exchange);
  background: var(--exchange-bg);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}


.row-count {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* ══════════════════════════════════════════
   Tab 2 — Portfolio
   ══════════════════════════════════════════ */

.portfolio-top {
  margin-bottom: 24px;
}

.portfolio-controls {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.budget-input-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.recency-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recency-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recency-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  min-width: 32px;
}

.recency-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.budget-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-with-prefix {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-with-prefix:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.prefix {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin-right: 4px;
}

.input-with-prefix input {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
  padding: 8px 0;
  width: 150px;
}

.input-with-prefix input::placeholder { color: var(--text-muted); }


/* ── Budget Bar ── */

.budget-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.budget-stats {
  display: flex;
  gap: 36px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.stat-label {
  display: block;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.progress-track {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.3s ease, background-color 0.3s;
}

.progress-fill.warn  { background: #f59e0b; }
.progress-fill.over  { background: var(--sale); }


/* ── Portfolio Table ── */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

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

thead {
  background: var(--bg-elevated);
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  user-select: none;
}

tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tbody tr:hover td {
  background: var(--bg-hover);
}

.col-ticker {
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.03em;
}

.col-pelosi-total {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.weight-col {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
}


/* ── Entry Column ── */

.entry-cell {
  white-space: nowrap;
}

.entry-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.entry-age {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 1px;
}

.entry-fresh { color: var(--purchase); }
.entry-mid   { color: #f59e0b; }
.entry-stale { color: var(--sale); }

.entry-unknown { color: var(--text-muted); }


/* ── Target Cell ── */

.target-cell {
  min-width: 170px;
}

.target-val {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-body);
  box-shadow: 0 0 6px var(--accent-dim);
  cursor: pointer;
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-body);
  cursor: pointer;
}


/* ── Holding Input ── */

.holding-cell {
  display: flex;
  align-items: center;
  gap: 0;
}

.holding-prefix {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 2px;
}

.holding-input {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  width: 100px;
  outline: none;
  transition: border-color 0.2s;
}

.holding-input:focus {
  border-color: var(--border-focus);
}


/* ── Action Column ── */

.action-buy {
  color: var(--purchase);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.action-sell {
  color: var(--sale);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.action-hold {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
}

.lock-row-btn {
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(201, 165, 78, 0.25);
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  vertical-align: middle;
}

.lock-row-btn:hover {
  background: rgba(201, 165, 78, 0.25);
  border-color: var(--accent);
}


/* ── Buttons ── */

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-accent {
  background: var(--accent);
  color: #0a0c12;
  box-shadow: 0 2px 10px var(--accent-dim);
}

.btn-accent:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-dim);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.portfolio-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.locked-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 4px;
}


/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}


/* ── Footer ── */

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}


/* ── Toast ── */

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ── Utilities ── */

.hidden { display: none !important; }


/* ── Responsive ── */

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 16px;
    gap: 8px;
  }

  main { padding: 20px 16px 64px; }

  .trades-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .filters { flex-direction: column; }
  .filter-input { width: 100%; }

  .budget-input-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .budget-stats { gap: 20px; }

  input[type="range"] { width: 100px; }
  .target-cell { min-width: 130px; }
}
