@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --brand-primary: #0066ff;
  --brand-primary-hover: #0052cc;
  --brand-primary-glow: #0066ff40;
  --brand-secondary: #00aaff;
  --brand-gradient: linear-gradient(135deg, #0066ff, #00aaff);
  --bg-primary: #080b10;
  --bg-secondary: #0d1117;
  --bg-tertiary: #161b22;
  --bg-sidebar: #0a0d14;
  --bg-card: #0f1520;
  --bg-card-hover: #141c2b;
  --bg-input: #0d1526;
  --color-buy: #00e676;
  --color-buy-bg: #00e67615;
  --color-sell: #ff1744;
  --color-sell-bg: #ff174415;
  --color-neutral: #848e9c;
  --text-primary: #e6edf3;
  --text-secondary: #7d8590;
  --text-tertiary: #484f58;
  --text-muted: #484f58;
  --text-blue: #58a6ff;
  --border-primary: #21262d;
  --border-secondary: #161b22;
  --border-blue: #0066ff30;
  --border-focus: #0066ff;
  --status-success: #00e676;
  --status-warning: #ff9f00;
  --status-danger: #ff1744;
  --status-info: #00aaff;
  --glow-sm: 0 0 8px #0066ff60;
  --glow-md: 0 0 16px #0066ff40;
  --glow-lg: 0 0 32px #0066ff30;
  --glow-text: 0 0 20px #00aaffaa;
  --shadow: 0 18px 60px rgba(0, 0, 0, .34);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg-primary); color: var(--text-primary); }
body { font-family: 'Inter', sans-serif; font-size: 13px; letter-spacing: 0; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.mono, .price, .ticker, .num { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--text-secondary); }
.positive { color: var(--color-buy); }
.negative { color: var(--color-sell); }
.warn { color: var(--status-warning); }
.hidden { display: none !important; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 12% 18%, rgba(0, 102, 255, .14), transparent 28%),
    linear-gradient(135deg, #0b0e11 0%, #10141c 46%, #090b0f 100%);
}
.auth-shell { width: min(1080px, calc(100vw - 32px)); display: grid; grid-template-columns: 1.2fr 420px; gap: 24px; align-items: stretch; }
.auth-visual { min-height: 560px; border: 1px solid var(--border-secondary); padding: 38px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(180deg, rgba(28,32,48,.8), rgba(15,17,23,.9)); }
.auth-visual h1 { max-width: 680px; margin: 0; font-size: clamp(38px, 6vw, 72px); line-height: .96; letter-spacing: 0; }
.auth-visual p { max-width: 520px; color: var(--text-secondary); font-size: 16px; line-height: 1.65; }
.brand-lockup { display: inline-flex; gap: 12px; align-items: center; font-weight: 800; font-size: 18px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--brand-gradient); color: #fff; font-weight: 900; border-radius: 4px; box-shadow: var(--glow-sm); }
.brand-lockup span:last-child, .logo { background: var(--brand-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(var(--glow-sm)); }
.auth-card { padding: 30px; align-self: center; }
.auth-card h2 { margin: 10px 0 8px; font-size: 30px; }
.stack-form { display: grid; gap: 16px; margin-top: 22px; }
label { display: grid; gap: 8px; color: var(--text-secondary); font-size: 12px; }
input, select, textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  min-height: 38px;
  border-radius: 4px;
  padding: 10px 12px;
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-glow); }
.form-error { min-height: 18px; color: var(--color-sell); }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; color: var(--text-secondary); }
.market-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.market-strip .mini-ticker { border: 1px solid var(--border-secondary); background: rgba(11,14,17,.6); padding: 12px; border-radius: 4px; }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: 56px 1fr; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 56px; display: flex; align-items: center; gap: 18px;
  padding: 0 18px; background: rgba(11,14,17,.95); border-bottom: 1px solid var(--border-secondary);
  backdrop-filter: blur(14px);
}
.topbar .brand-lockup { flex: 0 0 auto; }
.top-nav { display: flex; align-items: center; gap: 4px; height: 100%; }
.top-nav a { height: 100%; display: flex; align-items: center; padding: 0 12px; color: var(--text-secondary); border-bottom: 2px solid transparent; }
.top-nav a.active, .top-nav a:hover { color: var(--text-primary); border-bottom-color: var(--brand-primary); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search-pill { min-width: 170px; background: var(--bg-tertiary); color: var(--text-tertiary); padding: 8px 12px; border-radius: 4px; border: 1px solid var(--border-secondary); }
.badge-wrap { position: relative; }
.badge { position: absolute; top: -7px; right: -5px; min-width: 16px; height: 16px; border-radius: 10px; background: var(--color-sell); color: #fff; display: grid; place-items: center; font-size: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: var(--bg-tertiary); border: 1px solid var(--border-primary); border-radius: 50%; font-weight: 700; }

.main-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
.sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); background: var(--bg-sidebar); border-right: 1px solid var(--border-secondary); padding: 14px 10px; overflow: auto; transition: width .18s ease; }
.side-link { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; color: var(--text-secondary); border-radius: 4px; white-space: nowrap; }
.side-link:hover, .side-link.active { background: var(--bg-tertiary); color: var(--text-primary); }
.side-link.active, .sidebar-item.active { background: var(--brand-primary-glow); border-left: 3px solid var(--brand-primary); color: var(--brand-secondary); }
.side-section { margin: 14px 0 6px 10px; color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; }
.content { min-width: 0; padding: 18px; }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.page-title h1 { margin: 0; font-size: 24px; }
.demo-ribbon { background: var(--brand-primary-glow); color: var(--brand-secondary); border: 1px solid var(--border-blue); padding: 6px 10px; border-radius: 4px; font-weight: 700; box-shadow: var(--glow-sm); }

.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: 1.5fr 1fr 1fr; }
.grid-2 { grid-template-columns: minmax(260px, .8fr) 1.8fr; }
.grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card, .panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
}
.card { padding: 16px; }
.panel-header { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--border-secondary); }
.panel-body { padding: 14px; }
.stat-label { color: var(--text-secondary); font-size: 12px; }
.stat-value { font-size: 26px; font-weight: 800; margin: 8px 0; }
.spark { height: 42px; width: 100%; }
.donut {
  width: 168px; height: 168px; border-radius: 50%;
  background: conic-gradient(var(--brand-primary) 0 45%, var(--status-info) 45% 73%, var(--color-buy) 73% 91%, var(--text-tertiary) 91% 100%);
  margin: 8px auto; position: relative;
}
.donut:after { content: ""; position: absolute; inset: 38px; border-radius: 50%; background: var(--bg-secondary); border: 1px solid var(--border-secondary); }
.legend { display: grid; gap: 8px; color: var(--text-secondary); }
.swatch { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 2px; background: var(--brand-primary); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 9px; border-bottom: 1px solid var(--border-secondary); white-space: nowrap; }
th { color: var(--text-secondary); font-size: 11px; font-weight: 600; text-transform: uppercase; }
td { font-size: 12px; }
tr:hover td { background: rgba(28,32,48,.46); }
.table-wrap { overflow: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-secondary); margin-bottom: 14px; }
.tab { background: transparent; color: var(--text-secondary); border: 0; padding: 11px 14px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--text-primary); border-bottom-color: var(--brand-primary); }
.bottom-nav { display: none; }

@media (max-width: 1180px) {
  .main-layout { grid-template-columns: 64px 1fr; }
  .sidebar { width: 64px; overflow-x: hidden; }
  .sidebar:hover { width: 220px; z-index: 40; box-shadow: var(--shadow); }
  .side-link span:last-child, .side-section { opacity: 0; transition: opacity .15s; }
  .sidebar:hover .side-link span:last-child, .sidebar:hover .side-section { opacity: 1; }
  .grid-3, .grid-2, .grid-even { grid-template-columns: 1fr; }
  .top-nav .hide-tablet, .search-pill { display: none; }
}
@media (max-width: 767px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 320px; padding: 24px; }
  .market-strip { grid-template-columns: 1fr 1fr; }
  .app-shell { display: block; }
  .topbar { height: auto; min-height: 56px; gap: 8px; padding: 8px 10px; align-items: center; }
  .topbar .brand-lockup { font-size: 15px; gap: 8px; min-width: 0; }
  .topbar .brand-mark { width: 30px; height: 30px; font-size: 12px; }
  .top-actions { gap: 6px; margin-left: auto; }
  .top-actions .btn { min-height: 30px; padding: 6px 9px; }
  .avatar { width: 30px; height: 30px; font-size: 11px; }
  .top-nav, .top-actions .hide-mobile { display: none; }
  .main-layout { display: block; }
  .sidebar { display: none; }
  .content { padding: 12px 10px 76px; width: 100%; overflow: hidden; }
  .page-title { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .page-title h1 { font-size: 20px; line-height: 1.2; }
  .demo-ribbon { padding: 5px 8px; font-size: 11px; }
  .grid { gap: 10px; }
  .card { padding: 13px; border-radius: 5px; }
  .panel { border-radius: 5px; }
  .panel-header { min-height: 38px; padding: 8px 10px; gap: 8px; align-items: flex-start; flex-direction: column; }
  .panel-body { padding: 10px; }
  .stat-value { font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
  .stat-label, th, td { font-size: 11px; }
  th, td { padding: 8px 7px; }
  .table-wrap { border: 1px solid var(--border-secondary); border-radius: 5px; }
  .toolbar { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .toolbar input, .toolbar select, .toolbar .btn { width: 100%; }
  .tabs { overflow-x: auto; white-space: nowrap; padding-bottom: 1px; }
  .tab { flex: 0 0 auto; padding: 10px 12px; }
  .donut { width: 138px; height: 138px; }
  .donut:after { inset: 32px; }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(5,1fr); background: rgba(10,13,20,.98); border-top: 1px solid var(--border-secondary); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { min-width: 0; padding: 8px 2px; display: grid; place-items: center; gap: 4px; color: var(--text-secondary); font-size: 9px; line-height: 1.1; }
  .bottom-nav a.active { color: var(--brand-secondary); background: var(--brand-primary-glow); }
}

@media (max-width: 420px) {
  body { font-size: 12px; }
  .top-actions .btn-primary { max-width: 82px; overflow: hidden; text-overflow: ellipsis; }
  .auth-shell { width: min(100vw - 20px, 420px); }
  .auth-card { padding: 20px; }
  .market-strip { grid-template-columns: 1fr; }
}
