/* ═══════════════════════════════════════════════════════════════
   HARAZI — Base styles (reset + layout primitives)
   ═══════════════════════════════════════════════════════════════ */

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

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: var(--fs-13);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--info);
  text-decoration: none;
}
a:hover { color: #7aa9ff; }

button {
  font-family: var(--font-ui);
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, select, textarea {
  font-family: var(--font-ui);
  font-size: var(--fs-13);
  color: var(--text-0);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: 5px 9px;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--info);
  background: var(--bg-1);
}
input[type="checkbox"] {
  accent-color: var(--info);
  cursor: pointer;
}
input[type="number"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  padding: 1px 5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--text-1);
}

/* ── Monospace for numbers ───────────────────────────────── */
.mono,
.num,
td.num,
th.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ── Layout shell ────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
}

.app > main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: var(--sp-4) var(--sp-5);
}
.page--flush {
  padding: 0;
  overflow: hidden;
}

/* ── Scrollbars ──────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-0);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border: 2px solid var(--bg-0);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-4);
}

/* ── Text utilities ──────────────────────────────────────── */
.muted  { color: var(--text-1); }
.dim    { color: var(--text-2); }
.faint  { color: var(--text-3); }
.bull   { color: var(--bull); }
.bear   { color: var(--bear); }
.win    { color: var(--win); }
.loss   { color: var(--loss); }
.warn   { color: var(--warn); }
.info   { color: var(--info); }
.accent { color: var(--accent); }
.up::before    { content: "▲ "; color: var(--bull); }
.down::before  { content: "▼ "; color: var(--bear); }

.tabular { font-variant-numeric: tabular-nums; }

.h-label {
  font-size: var(--fs-11);
  font-weight: var(--fw-semi);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.h-section {
  font-size: var(--fs-14);
  font-weight: var(--fw-bold);
  color: var(--text-0);
}

/* ── Flex helpers ────────────────────────────────────────── */
.row { display: flex; align-items: center; }
.row--gap-1 { gap: var(--sp-1); }
.row--gap-2 { gap: var(--sp-2); }
.row--gap-3 { gap: var(--sp-3); }
.row--gap-4 { gap: var(--sp-4); }
.row--between { justify-content: space-between; }
.row--end     { justify-content: flex-end; }
.stack {
  display: flex;
  flex-direction: column;
}
.stack--gap-1 { gap: var(--sp-1); }
.stack--gap-2 { gap: var(--sp-2); }
.stack--gap-3 { gap: var(--sp-3); }
.stack--gap-4 { gap: var(--sp-4); }
.spacer { flex: 1 1 auto; }

/* ── Hidden ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* ── Focus ring (accessibility, subtle) ──────────────────── */
:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 1px;
  border-radius: var(--r-2);
}

/* Plotly svg crispness */
.js-plotly-plot .plotly .modebar { display: none !important; }
