/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --border:    #2a2d3a;
  --accent:    #6c63ff;
  --green:     #22c55e;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Nav ─────────────────────────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--border);
  color: var(--text);
  text-decoration: none;
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #7c73ff; }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-buy     { background: rgba(34,197,94,0.15);  color: var(--green); }
.badge-hold    { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-skip    { background: rgba(100,116,139,0.15); color: var(--muted); }
.badge-high    { background: rgba(108,99,255,0.15); color: var(--accent); }
.badge-medium  { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-low     { background: rgba(239,68,68,0.15);  color: var(--red); }
.badge-pending   { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-approved  { background: rgba(34,197,94,0.15);  color: var(--green); }
.badge-rejected  { background: rgba(239,68,68,0.15);  color: var(--red); }
.badge-expired   { background: rgba(100,116,139,0.15); color: var(--muted); }

/* ─── Recommendation Card ─────────────────────────────────────────────────── */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.rec-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.rec-card:hover { border-color: var(--accent); }
.rec-card.buy   { border-left: 3px solid var(--green); }
.rec-card.hold  { border-left: 3px solid var(--yellow); }
.rec-card.skip  { border-left: 3px solid var(--muted); }

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.rec-ticker {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.rec-price {
  font-size: 13px;
  color: var(--muted);
}

.rec-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12px;
}

.stat { display: flex; justify-content: space-between; }
.stat-label { color: var(--muted); }
.stat-value { font-weight: 600; }

.rec-reasoning {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.rec-actions {
  display: flex;
  gap: 8px;
}

/* ─── Scan Status Bar ─────────────────────────────────────────────────────── */
#scan-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

#scan-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

#scan-status-dot.running { background: var(--green); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#scan-log {
  flex: 1;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Portfolio Summary ───────────────────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.account-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.account-stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.account-stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ─── Filter Tabs ─────────────────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: all 0.15s;
}

.filter-tab:hover,
.filter-tab.active { background: var(--border); color: var(--text); }

/* ─── Positive / Negative colours ────────────────────────────────────────── */
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ─── Toast ───────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 999;
  max-width: 320px;
}

#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); }
#toast.error   { border-color: var(--red); }
