/* ============================================================
   TradeCompass Admin — Premium dark console
   ============================================================ */

:root {
  --bg:        #060A12;
  --bg-2:      #0A101C;
  --surface:   #0E1626;
  --surface-2: #131E33;
  --surface-3: #1A2740;
  --line:      rgba(255,255,255,.075);
  --line-2:    rgba(255,255,255,.14);

  --ink:   #E9EFFA;
  --ink-2: #AEBDD4;
  --muted: #6E809D;

  --teal:    #14E0C8;
  --emerald: #35E39C;
  --violet:  #7C5CFF;
  --gold:    #F5C86B;
  --grad:    linear-gradient(135deg, #14E0C8 0%, #35E39C 100%);
  --grad-ai: linear-gradient(120deg, #7C5CFF 0%, #14E0C8 52%, #35E39C 100%);

  --up: #22D98A; --down: #FF5C72; --warn: #F5C86B;

  /* legacy aliases so existing admin markup stays correct */
  --navy: #FFFFFF; --card: var(--surface); --green: #22D98A; --red: #FF5C72; --amber: #F5C86B;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 14px 40px -14px rgba(0,0,0,.7);
  --font: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 8% -6%, rgba(20,224,200,.08), transparent 60%),
    radial-gradient(800px 460px at 96% 2%, rgba(124,92,255,.08), transparent 62%);
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--emerald); }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- Shell ---------------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 238px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: rgba(10,16,28,.86); backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
}
.side .brand {
  display: flex; align-items: center; gap: 9px; padding: 19px 18px; font-weight: 800; font-size: 1.1rem;
  color: #fff; letter-spacing: -.02em; border-bottom: 1px solid var(--line);
}
.side .brand .badge {
  background: var(--grad); color: #04211E; font-size: .58rem; padding: 3px 7px;
  border-radius: 6px; font-weight: 900; letter-spacing: .09em;
}
.side .grp {
  padding: 17px 18px 6px; font-size: .655rem; text-transform: uppercase;
  letter-spacing: .13em; color: var(--muted); font-weight: 800;
}
.side a.item {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px; margin: 1px 8px;
  border-radius: 10px; color: var(--ink-2); font-size: .91rem; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.side a.item:hover { background: rgba(255,255,255,.055); color: #fff; }
.side a.item.active { background: rgba(20,224,200,.11); color: #fff; box-shadow: inset 0 0 0 1px rgba(20,224,200,.22); }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 14px; padding: 0 26px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(6,10,18,.78); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.12rem; margin: 0; color: #fff; font-weight: 700; letter-spacing: -.02em; }
.topbar .sp { flex: 1; }
.content { padding: 24px 26px 46px; }

/* ---------------- Cards ---------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card .pad { padding: 20px; }
.card h3 { margin: 0 0 14px; font-size: 1rem; color: #fff; font-weight: 700; letter-spacing: -.015em; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px)  { .g2, .g3, .g4 { grid-template-columns: 1fr; } .side { display: none; } }

.stat {
  display: block;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 19px; box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), border-color .18s ease;
}
.stat .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; }
.stat .value { font-size: 1.62rem; font-weight: 800; color: #fff; margin-top: 5px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
a.stat:hover { transform: translateY(-3px); border-color: rgba(20,224,200,.4); }

/* ---------------- Tables ---------------- */
table.tc { width: 100%; border-collapse: collapse; }
table.tc th {
  text-align: left; font-size: .69rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 800; padding: 10px 11px; border-bottom: 1px solid var(--line-2);
}
table.tc td { padding: 10px 11px; border-bottom: 1px solid var(--line); font-size: .875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
table.tc tbody tr { transition: background .14s ease; }
table.tc tbody tr:hover td { background: rgba(20,224,200,.045); color: var(--ink); }
table.tc tbody tr:last-child td { border-bottom: none; }
.sym { font-weight: 800; color: #fff; }
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 15px;
  font-weight: 700; font-size: .875rem; cursor: pointer; font-family: inherit; text-decoration: none;
  transition: transform .15s cubic-bezier(.2,.8,.2,1), background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1.5px); }
.btn.primary { background: var(--grad); color: #04211E; box-shadow: 0 7px 22px -8px rgba(20,224,200,.6); }
.btn.primary:hover { color: #04211E; }
.btn.navy { background: var(--surface-3); color: #fff; border-color: var(--line-2); }
.btn.navy:hover { background: #223454; color: #fff; }
.btn.ghost { background: rgba(255,255,255,.04); border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: rgba(20,224,200,.5); color: #fff; }
.btn.ai { background: var(--grad-ai); color: #fff; }
.btn.danger { background: rgba(255,92,114,.12); border-color: rgba(255,92,114,.35); color: #FFAEB9; }
.btn.sm { padding: 6px 11px; font-size: .8rem; border-radius: 9px; }

/* ---------------- Badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: .715rem; letter-spacing: .04em; text-transform: uppercase; }
.badge.buy  { background: rgba(34,217,138,.15); color: #5CF0AE; box-shadow: inset 0 0 0 1px rgba(34,217,138,.3); }
.badge.sell { background: rgba(255,92,114,.15); color: #FF97A6; box-shadow: inset 0 0 0 1px rgba(255,92,114,.3); }
.badge.hold { background: rgba(245,200,107,.14); color: #F5D394; box-shadow: inset 0 0 0 1px rgba(245,200,107,.28); }
.badge.soft { background: rgba(255,255,255,.06); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.badge.on   { background: rgba(34,217,138,.15); color: #5CF0AE; box-shadow: inset 0 0 0 1px rgba(34,217,138,.3); }
.badge.off  { background: rgba(255,92,114,.15); color: #FF97A6; box-shadow: inset 0 0 0 1px rgba(255,92,114,.3); }
.badge.ai   { background: rgba(124,92,255,.16); color: #C0B0FF; box-shadow: inset 0 0 0 1px rgba(124,92,255,.34); }
.up { color: var(--up); font-weight: 700; } .down { color: var(--down); font-weight: 700; }

/* ---------------- Forms ---------------- */
.filters { display: flex; gap: 11px; align-items: end; flex-wrap: wrap; }
.field { margin: 0; }
.field label { display: block; font-size: .74rem; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; font-size: .875rem;
  width: 100%; background: rgba(255,255,255,.04); color: var(--ink); font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20,224,200,.13);
}
.field select option { background: var(--surface-2); color: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 1.32rem; color: #fff; font-weight: 800; letter-spacing: -.03em; }

.alert { padding: 11px 15px; border-radius: 10px; font-size: .875rem; margin-bottom: 15px; border: 1px solid transparent; }
.alert.ok  { background: rgba(34,217,138,.1); color: #7EF0BE; border-color: rgba(34,217,138,.3); }
.alert.err { background: rgba(255,92,114,.1); color: #FFAEB9; border-color: rgba(255,92,114,.3); }

/* ---------------- Login ---------------- */
.login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px;
  background:
    radial-gradient(900px 520px at 20% 0%, rgba(20,224,200,.13), transparent 60%),
    radial-gradient(820px 480px at 85% 10%, rgba(124,92,255,.14), transparent 62%),
    #060A12;
}
.login-card {
  width: 396px; max-width: 100%; padding: 34px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  border: 1px solid var(--line-2); border-radius: 20px;
  box-shadow: 0 30px 90px -20px rgba(0,0,0,.9); backdrop-filter: blur(18px);
}
.login-card code { background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 5px; color: var(--teal); }

::selection { background: rgba(20,224,200,.3); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: #22304C; border-radius: 999px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: #2E4066; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
