/* ============================================================
   Quantum — DEX Quant Trading Terminal
   Shared design tokens + utility classes
   Based on Claude DESIGN.md (warm cream + coral + dark editorial)
   ============================================================ */

:root {
  /* colors */
  --primary: #cc785c;
  --primary-active: #a9583e;
  --primary-soft: #e6dfd8;
  --primary-tint: #f6e7df;
  --ink: #141413;
  --body: #3d3d3a;
  --body-strong: #252523;
  --muted: #6c6a64;
  --muted-soft: #8e8b82;
  --hairline: #e6dfd8;
  --hairline-soft: #ebe6df;
  --canvas: #faf9f5;
  --surface-soft: #f5f0e8;
  --surface-card: #efe9de;
  --surface-cream-strong: #e8e0d2;
  --dark: #181715;
  --dark-elev: #252320;
  --dark-soft: #1f1e1b;
  --dark-hairline: #2c2a26;
  --on-dark: #faf9f5;
  --on-dark-soft: #a09d96;
  --teal: #5db8a6;
  --teal-dark: #2d6b5e;
  --amber: #e8a55a;
  --success: #5db872;
  --warning: #d4a017;
  --error: #c64545;

  /* radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-pill: 9999px;

  /* shadows */
  --shadow-cream: 0 1px 0 var(--hairline-soft), 0 12px 32px -16px rgba(20, 20, 19, .08);
  --shadow-dark: 0 1px 0 rgba(0,0,0,.3), 0 12px 32px -16px rgba(0,0,0,.5);
}

/* base */
* { box-sizing: border-box; }
html, body { background: var(--canvas); color: var(--ink); margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "ss01", "cv11";
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* typography */
.font-serif { font-family: 'Instrument Serif', 'Tiempos Headline', Georgia, serif; letter-spacing: -0.01em; font-weight: 400; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.display-xl { font-family: 'Instrument Serif', serif; font-size: 64px; line-height: 1.05; letter-spacing: -1.5px; }
.display-lg { font-family: 'Instrument Serif', serif; font-size: 48px; line-height: 1.1; letter-spacing: -1px; }
.display-md { font-family: 'Instrument Serif', serif; font-size: 36px; line-height: 1.15; letter-spacing: -0.5px; }
.display-sm { font-family: 'Instrument Serif', serif; font-size: 28px; line-height: 1.2; letter-spacing: -0.3px; }
.title-lg { font-size: 22px; font-weight: 500; line-height: 1.3; }
.title-md { font-size: 18px; font-weight: 500; line-height: 1.4; }
.title-sm { font-size: 16px; font-weight: 500; line-height: 1.4; }
.body-md { font-size: 16px; font-weight: 400; line-height: 1.55; }
.body-sm { font-size: 14px; font-weight: 400; line-height: 1.55; }
.caption { font-size: 13px; font-weight: 500; line-height: 1.4; }
.caption-uc { font-size: 11px; font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; }
.tabular { font-variant-numeric: tabular-nums; }

/* colors */
.text-ink { color: var(--ink); }
.text-body { color: var(--body); }
.text-muted { color: var(--muted); }
.text-muted-soft { color: var(--muted-soft); }
.text-primary { color: var(--primary); }
.text-primary-active { color: var(--primary-active); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-teal { color: var(--teal); }
.text-amber { color: var(--amber); }
.text-on-dark { color: var(--on-dark); }
.text-on-dark-soft { color: var(--on-dark-soft); }

.bg-canvas { background: var(--canvas); }
.bg-surface-soft { background: var(--surface-soft); }
.bg-surface-card { background: var(--surface-card); }
.bg-surface-cream-strong { background: var(--surface-cream-strong); }
.bg-dark { background: var(--dark); }
.bg-dark-elev { background: var(--dark-elev); }
.bg-dark-soft { background: var(--dark-soft); }
.bg-primary { background: var(--primary); }
.bg-primary-active { background: var(--primary-active); }
.bg-primary-soft { background: var(--primary-soft); }
.bg-primary-tint { background: var(--primary-tint); }
.bg-success { background: var(--success); }
.bg-error { background: var(--error); }
.bg-warning { background: var(--warning); }
.bg-teal { background: var(--teal); }
.bg-amber { background: var(--amber); }
.bg-ink { background: var(--ink); }

/* borders */
.hairline { border-color: var(--hairline); }
.hairline-soft { border-color: var(--hairline-soft); }
.dark-hairline { border-color: var(--dark-hairline); }
.ring-soft { box-shadow: 0 0 0 1px var(--hairline); }
.ring-soft-dark { box-shadow: 0 0 0 1px var(--dark-hairline); }

/* shadows */
.shadow-cream { box-shadow: var(--shadow-cream); }
.shadow-dark { box-shadow: var(--shadow-dark); }

/* patterns */
.grid-bg-dark {
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 32px;
}
.grid-bg-cream {
  background-image:
    linear-gradient(rgba(20,20,19,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,20,19,.03) 1px, transparent 1px);
  background-size: 48px 32px;
}
.noise {
  position: relative;
}
.noise::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* glow / radial accents */
.radial-coral-tr {
  position: relative; overflow: hidden;
}
.radial-coral-tr::before {
  content: ""; position: absolute; right: -80px; top: -80px; width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(204,120,92,.35) 0%, transparent 60%);
  pointer-events: none;
}
.radial-coral-br {
  position: relative; overflow: hidden;
}
.radial-coral-br::before {
  content: ""; position: absolute; right: -60px; bottom: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(204,120,92,.3) 0%, transparent 60%);
  pointer-events: none;
}

/* scrollbar */
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { scrollbar-width: none; }

/* page section spacing */
.page-wrap { max-width: 1440px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }

/* button base */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       height: 40px; padding: 0 16px; border-radius: var(--r-md); font-size: 14px;
       font-weight: 500; line-height: 1; transition: all .12s ease; cursor: pointer; border: 0; }
.btn-primary { background: var(--primary); color: var(--on-dark); }
.btn-primary:hover { background: var(--primary-active); }
.btn-secondary { background: var(--canvas); color: var(--ink); box-shadow: 0 0 0 1px var(--hairline); }
.btn-secondary:hover { background: var(--surface-soft); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-on-dark { background: var(--dark-elev); color: var(--on-dark); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }

/* pill / chip */
.chip { display: inline-flex; align-items: center; gap: 6px;
        padding: 4px 12px; border-radius: var(--r-pill);
        background: var(--surface-card); color: var(--ink);
        font-size: 12px; font-weight: 500; }
.chip-coral { background: var(--primary); color: var(--on-dark); text-transform: uppercase; letter-spacing: 1.2px; font-size: 11px; }
.chip-soft { background: var(--primary-tint); color: var(--primary-active); }
.chip-dark { background: var(--dark-elev); color: var(--on-dark); }
.chip-success { background: rgba(93,184,114,.12); color: var(--success); }
.chip-error { background: rgba(198,69,69,.10); color: var(--error); }

/* status dot */
.dot { display:inline-block; width:6px; height:6px; border-radius:50%; }
.dot-success { background: var(--success); box-shadow: 0 0 0 3px rgba(93,184,114,.15); }
.dot-error { background: var(--error); box-shadow: 0 0 0 3px rgba(198,69,69,.12); }
.dot-warning { background: var(--warning); }
.dot-muted { background: var(--muted-soft); }
.dot-primary { background: var(--primary); box-shadow: 0 0 0 3px rgba(204,120,92,.15); }

/* card */
.card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-xl);
        box-shadow: var(--shadow-cream); }
.card-dark { background: var(--dark); border-radius: var(--r-xl); color: var(--on-dark); }
.card-soft { background: var(--surface-card); border-radius: var(--r-lg); }

/* input */
.input { height: 40px; padding: 0 14px; background: var(--canvas);
         border: 1px solid var(--hairline); border-radius: var(--r-md);
         font-size: 14px; color: var(--ink); width: 100%; }
.input:focus { outline: none; border-color: var(--ink); }
.input-dark { background: var(--dark-soft); color: var(--on-dark); border-color: var(--dark-hairline); }

/* toggle */
.toggle { display:inline-block; width:32px; height:18px; border-radius: 9999px;
          background: var(--surface-card); position: relative; cursor: pointer; transition: .15s; }
.toggle::after { content: ""; position: absolute; left: 2px; top: 2px;
                 width: 14px; height: 14px; border-radius: 50%; background: white;
                 box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: .15s; }
.toggle.on { background: var(--primary); }
.toggle.on::after { left: 16px; }

/* progress bar */
.progress { height: 4px; border-radius: 9999px; background: var(--surface-card); overflow: hidden; }
.progress > span { display:block; height: 100%; background: var(--primary); border-radius: 9999px; }
.progress-dark { background: var(--dark-elev); }

/* page heading band */
.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 40px 0 28px 0;
}
.crumbs { display:flex; align-items:center; gap: 8px; font-size: 11px; letter-spacing: 1.5px;
          text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 12px; }

/* table */
table.q-table { width: 100%; border-collapse: collapse; }
table.q-table thead th { text-align: left; padding: 12px 0; font-size: 11px; font-weight: 500;
                          letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted-soft);
                          border-bottom: 1px solid var(--hairline-soft); }
table.q-table tbody td { padding: 14px 0; font-size: 13px; border-bottom: 1px solid var(--hairline-soft); }
table.q-table tbody tr:last-child td { border-bottom: 0; }
table.q-table .pad-l { padding-left: 24px; }
table.q-table .pad-r { padding-right: 24px; }

/* helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-1\.5 { gap: 6px; } .gap-2 { gap: 8px; } .gap-2\.5 { gap: 10px; }
.gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.gap-8 { gap: 32px; } .gap-10 { gap: 40px; }

.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }
.overflow-hidden { overflow: hidden; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: .04em; }

.opacity-50 { opacity: .5; } .opacity-60 { opacity: .6; } .opacity-70 { opacity: .7; }

/* spike mark */
.spike-mark { display: inline-block; }
