/* ============ NIFTY BULL · WARM-CREAM + INDIGO ACCENT ============
   Ported from design/design_handoff_nifty_bull/prototype/styles.css.
   Token names and values are kept verbatim — the prototype is the
   single source of truth for the visual language.
   ================================================================= */
:root {
    /* Type */
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    /* Subtle warm-cream palette — very light, minimal chroma */
    --bg: oklch(0.985 0.006 82);
    --bg-2: oklch(0.975 0.008 80);
    --surface: oklch(0.998 0.003 82);
    --surface-2: oklch(0.965 0.01 80);
    --surface-3: oklch(0.94 0.012 78);

    --border: oklch(0.9 0.01 78);
    --border-strong: oklch(0.82 0.012 72);

    --text: oklch(0.24 0.015 60);
    --text-2: oklch(0.46 0.018 65);
    --text-3: oklch(0.62 0.018 68);
    --text-4: oklch(0.75 0.014 72);

    /* Indigo accent */
    --accent: oklch(0.55 0.15 265);
    --accent-hover: oklch(0.5 0.16 265);
    --accent-soft: oklch(0.93 0.04 265);
    --accent-softer: oklch(0.965 0.02 265);
    --accent-text: oklch(0.45 0.18 265);
    --accent-ring: oklch(0.55 0.15 265 / 0.18);

    /* Semantic */
    --up: oklch(0.58 0.13 150);
    --up-soft: oklch(0.94 0.045 150);
    --down: oklch(0.55 0.15 30);
    --down-soft: oklch(0.94 0.035 35);

    /* Chart series */
    --chart-1: oklch(0.55 0.15 265);
    --chart-2: oklch(0.58 0.13 150);
    --chart-3: oklch(0.68 0.08 65);
    --chart-4: oklch(0.28 0.02 60);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-xs: 0 1px 0 0 oklch(0.3 0.04 70 / 0.04);
    --shadow-sm: 0 1px 2px 0 oklch(0.3 0.04 70 / 0.06), 0 1px 1px 0 oklch(0.3 0.04 70 / 0.04);
    --shadow-md: 0 4px 12px -2px oklch(0.3 0.04 70 / 0.1), 0 2px 4px -2px oklch(0.3 0.04 70 / 0.06);
    --shadow-lg: 0 20px 40px -12px oklch(0.3 0.04 70 / 0.14), 0 4px 8px -4px oklch(0.3 0.04 70 / 0.08);

    --shadow-selected: 0 6px 16px -4px oklch(0.55 0.15 265 / 0.28), 0 2px 4px -1px oklch(0.55 0.15 265 / 0.18);
    --shadow-selected-neutral: 0 6px 14px -4px oklch(0.3 0.04 70 / 0.18), 0 2px 4px -1px oklch(0.3 0.04 70 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01';
    letter-spacing: -0.006em;
}

.mono {
    font-family: var(--font-mono);
    font-feature-settings: 'tnum' on, 'zero' on;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: 500 13.5px/1 var(--font-sans);
    letter-spacing: -0.004em;
    padding: 10px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, transform 100ms ease, box-shadow 160ms ease, color 140ms ease;
}

.btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.btn:active {
    transform: translateY(1px);
}

.btn[disabled],
.btn[disabled]:hover {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--surface);
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.btn.accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.btn.accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}

.btn.ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn.sm {
    padding: 7px 10px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn.xs {
    padding: 5px 9px;
    font-size: 11.5px;
    border-radius: 6px;
}

.btn.chip {
    background: var(--surface);
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 200ms ease, color 160ms ease;
}

.btn.chip.selected {
    background: var(--accent-softer);
    border-color: var(--accent);
    color: var(--accent-text);
    box-shadow: var(--shadow-selected);
    transform: translateY(-1px);
}

/* Inputs */
.input,
.select {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: 500 14px/1.2 var(--font-sans);
    padding: 11px 12px;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.input:hover,
.select:hover {
    border-color: var(--border-strong);
}

.input:focus,
.select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.input.mono {
    font-family: var(--font-mono);
}

.label {
    display: block;
    font: 500 11.5px/1 var(--font-sans);
    color: var(--text-3);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 9px;
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

/* Pill / chip */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 500 11.5px/1 var(--font-sans);
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.pill.up {
    background: var(--up-soft);
    color: var(--up);
    border-color: transparent;
}

.pill.down {
    background: var(--down-soft);
    color: var(--down);
    border-color: transparent;
}

.pill.accent {
    background: var(--accent-soft);
    color: var(--accent-text);
    border-color: transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
    background: oklch(0.85 0.02 75);
    border-radius: 999px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.025 72); }

.hr { height: 1px; background: var(--border); border: 0; margin: 0; }

@keyframes pulse-dot {
    0%, 80%, 100% { transform: scale(0.4); opacity: 0.35; }
    40% { transform: scale(1); opacity: 1; }
}

.dots { display: inline-flex; gap: 4px; }
.dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.2s ease-in-out infinite both;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in 300ms ease-out both; }

@keyframes slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.slide-up { animation: slide-up 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.seg {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 3px;
    border-radius: 10px;
    gap: 2px;
}

.seg button {
    border: 0;
    background: transparent;
    padding: 8px 14px;
    border-radius: 7px;
    font: 500 12.5px/1 var(--font-sans);
    color: var(--text-2);
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, box-shadow 200ms ease, transform 120ms ease;
}

.seg button:hover { color: var(--text); }

.seg button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-selected-neutral);
    transform: translateY(-0.5px);
}

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

.table th {
    text-align: left;
    font: 500 11px/1 var(--font-sans);
    color: var(--text-3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font: 500 13.5px/1.2 var(--font-sans);
    color: var(--text);
}

.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.side-buy {
    font: 600 11px/1 var(--font-mono);
    padding: 5px 9px;
    border-radius: 5px;
    background: var(--up-soft);
    color: var(--up);
    letter-spacing: 0.04em;
}

.side-sell {
    font: 600 11px/1 var(--font-mono);
    padding: 5px 9px;
    border-radius: 5px;
    background: var(--down-soft);
    color: var(--down);
    letter-spacing: 0.04em;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: oklch(0.3 0.03 65 / 0.35);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fade-in 180ms ease-out both;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: min(580px, 92vw);
    max-height: 85vh;
    overflow: auto;
    animation: slide-up 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    z-index: 200;
    max-width: 360px;
    font-size: 13px;
    color: var(--text);
    animation: slide-up 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast.error { border-color: var(--down); color: var(--down); }
.toast.ok { border-color: var(--up); }

.app-shell {
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

.empty {
    padding: 48px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
}

/* ---------- Hover-info hint (Hint component in ui.jsx) ---------- */
.hint {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-4);
    cursor: help;
    transition: color 120ms ease;
}

.hint:hover { color: var(--accent-text); }

.hint-popup {
    /* Position is supplied inline (top/left or right) by Hint; the
       popup is portaled to document.body so it escapes any clipping
       overflow:hidden ancestor. */
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 12px 14px;
    font: 400 12.5px/1.55 var(--font-sans);
    color: var(--text-2);
    pointer-events: none;
    text-transform: none;
    letter-spacing: -0.004em;
    /* Default: popup ABOVE the icon → triangle on the bottom edge. */
}

/* Default triangle: points down from the bottom of the popup. */
.hint-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 12px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--surface);
}

/* Flipped: popup BELOW the icon → triangle on the top edge. */
.hint-popup.flipped::after {
    top: auto;
    bottom: 100%;
    border-top: none;
    border-bottom: 6px solid var(--surface);
}

/* Anchor-right: popup right-aligned to the icon → triangle on the right. */
.hint-popup.anchor-right::after {
    left: auto;
    right: 12px;
}

.hint-popup strong {
    color: var(--text);
    font-weight: 600;
}

.hint-popup code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text);
}
