/* LK & Associates Capital — Fintech Dashboard */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0f0f0f;
  --surface: #171717;
  --surface2: #1f1f1f;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --text: #f5f5f5;
  --muted: #888;
  --faint: #444;
  --green: #00C896;
  --green-dim: rgba(0,200,150,0.1);
  --red: #FF5252;
  --red-dim: rgba(255,82,82,0.1);
  --gold: #F5A623;
  --gold-dim: rgba(245,166,35,0.1);
  --purple: #A47AFF;
  --purple-dim: rgba(138,100,255,0.12);
  --r: 12px;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 36px;
  text-decoration: none;
}

.logo-mark {
  width: 32px; height: 32px;
  background: var(--text);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--bg);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.logo-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-section {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--faint);
  text-transform: uppercase;
  padding: 16px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
  background: none;
}

.nav-link:hover { background: var(--surface); color: var(--text); }

.nav-link.active {
  background: var(--surface2);
  color: var(--text);
  font-weight: 500;
}

.nav-icon {
  width: 16px; height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
}

.avatar {
  width: 30px; height: 30px;
  background: var(--surface2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}

.user-info { flex: 1; }
.user-name { font-size: 12.5px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); }
.logout-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.logout-link:hover { color: var(--red); }

/* ── Main Content ────────────────────────────────────── */
.content {
  margin-left: 220px;
  flex: 1;
  padding: 32px 40px;
  max-width: 1100px;
}

/* ── Page Header ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title { font-size: 22px; font-weight: 500; letter-spacing: -0.4px; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Status Badge ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255,82,82,0.2);
}

.badge.online {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(0,200,150,0.2);
}

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

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

/* ── Stats Row ───────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  transition: border-color 0.15s;
  animation: fadeUp 0.4s ease both;
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

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

.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-change {
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-change.neutral { color: var(--muted); }

/* ── Two Column Grid ─────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 16px;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  animation: fadeUp 0.4s ease 0.25s both;
  margin-bottom: 16px;
}

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

.card-title { font-size: 14px; font-weight: 500; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Chart ────────────────────────────────────────────── */
.chart-wrap { padding: 20px; }

.chart-card canvas {
  width: 100% !important;
  max-height: 260px;
}

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

.chart-tab {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: inherit;
  transition: all 0.15s;
}

.chart-tab:hover { color: var(--text); }
.chart-tab.active { background: var(--surface2); color: var(--text); }

.empty-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  color: var(--faint);
  font-size: 13px;
  gap: 8px;
}

/* ── Bot Status Card ──────────────────────────────────── */
.bot-grid { display: flex; flex-direction: column; }

.bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.bot-row:last-child { border-bottom: none; }
.bot-key { color: var(--muted); }
.bot-val { font-weight: 500; font-family: 'DM Mono', monospace; font-size: 12.5px; }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.info-table { width: 100%; font-size: 14px; }
.info-table td { padding: 8px 0; }
.info-table td:first-child { color: var(--muted); width: 180px; }

/* Mono for financial data */
.mono { font-family: 'DM Mono', monospace; font-size: 12.5px; }
.green { color: var(--green); }
.red { color: var(--red); }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }

/* ── Type Pills ───────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.pill-pred { background: var(--gold-dim); color: var(--gold); }
.pill-dutch { background: var(--green-dim); color: var(--green); }
.pill-ladder { background: var(--purple-dim); color: var(--purple); }
.pill-intra { background: rgba(255,255,255,0.06); color: var(--text); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255,82,82,0.2);
}
.btn-danger:hover { background: rgba(255,82,82,0.18); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ── Inline Forms ─────────────────────────────────────── */
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 16px 20px;
  padding: 14px;
  background: var(--surface2);
  border-radius: var(--r);
}

.inline-form input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}

.inline-form input:focus {
  outline: none;
  border-color: var(--border-hover);
}

.inline-edit {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 4px 8px;
  width: 100px;
  font-size: 13px;
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
}

.inline-edit:hover, .inline-edit:focus {
  border-color: var(--border);
  background: var(--bg);
  outline: none;
}

/* ── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  padding: 16px 20px 12px;
}

.pagination .btn-active {
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}

.pagination .btn-disabled {
  color: var(--faint);
  cursor: default;
  border-color: transparent;
  background: none;
}

.pagination .btn-disabled:hover { opacity: 1; }

.pagination a.btn {
  text-decoration: none;
  color: var(--text);
}

/* ── Login Page ───────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 44px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card h1 {
  color: var(--text);
  font-size: 22px;
  margin-bottom: 4px;
  font-weight: 500;
  letter-spacing: -0.3px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-card .form-group { text-align: left; margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-hover);
}

.login-card .btn { margin-top: 8px; width: 100%; }

.alert {
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 13px;
}

.alert-error {
  background: var(--red-dim);
  border: 1px solid rgba(255,82,82,0.2);
  color: var(--red);
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 4px; }

/* ── Mobile Header ────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
}

.mobile-brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.mobile-menu-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 20px;
  padding: 4px 10px;
  cursor: pointer;
}

.mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.mobile-nav.open { display: block; }

.mobile-nav a {
  display: block;
  padding: 14px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-top: 1px solid var(--border);
}

.mobile-nav a:hover {
  background: rgba(255,255,255,0.04);
  color: var(--green);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 60px 16px 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .inline-form { flex-wrap: wrap; }
  .page-header { flex-direction: column; gap: 12px; }
  .header-actions { flex-wrap: wrap; }
}
