/* ═══════════════════════════════════════════════════════════════════
   DerivEdge — TradeLocker / Bloomberg Terminal Theme
   Pure black, flat, sharp, data-dense
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg: #000000;
    --bg-panel: #0d0d0d;
    --bg-hover: #111111;
    --border: #1a1a1a;
    --text: #f0f2f5;
    --text-muted: #a8adb8;
    --text-dim: #7a7f8e;
    --text-off: #555a68;
    --bull: #2ec4b6;
    --bear: #ff6b6b;
    --blue: #4285f4;
    --warn: #ffab40;
    --purple: #9c27b0;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, sans-serif;
    --mono: Consolas, 'Cascadia Code', 'Courier New', monospace;
}

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

::selection { background: rgba(41,98,255,0.3); }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 450;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.hdr-label {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.hdr-price {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.hdr-change {
    font-family: var(--mono);
    font-size: 12px;
}
.hdr-time {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
}
.hdr-updated {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
}
.hdr-sep {
    color: var(--text-off);
    font-size: 14px;
    margin: 0 4px;
}
.hdr-brand {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.status-pill {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border: 1px solid;
}
.status-pill.open { color: var(--bull); border-color: var(--bull); }
.status-pill.pre { color: var(--warn); border-color: var(--warn); }
.status-pill.closed { color: var(--text-off); border-color: var(--text-off); }

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-off);
}
.live-dot.blink {
    background: var(--bull);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.bull { color: var(--bull) !important; }
.bear { color: var(--bear) !important; }
.warn { color: var(--warn) !important; }

/* ── Layout ─────────────────────────────────────────────────────── */
.container {
    display: grid;
    grid-template-columns: 1fr;
    height: calc(100vh - 40px);
}
.dashboard {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Panels ─────────────────────────────────────────────────────── */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 0;
    border-left: 3px solid transparent;
}
.panel-hdr {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.panel-body {
    padding: 12px;
}
.panel-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 8px;
}

/* ── Regime Card ────────────────────────────────────────────────── */
.regime-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.regime-left { flex: 1; }
.regime-right { text-align: right; }
.regime-name {
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.regime-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.badge-outline {
    font-size: 12px;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border: 1px solid var(--text-off);
    color: var(--text-off);
    background: transparent;
}
.regime-summary {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
    max-width: 500px;
}
.strategy-label {
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.strategy-value {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
}

/* ── Trade Setup ────────────────────────────────────────────────── */
.trade-setup { }
.ts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.ts-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    border-bottom: 1px solid #111111;
}
.ts-row.ts-action {
    grid-column: 1 / -1;
    background: rgba(41,98,255,0.06);
}
.ts-label {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.ts-val {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.ts-why {
    font-size: 12px;
    color: var(--text);
    padding: 8px;
    border-top: 1px solid #111111;
}
.ts-notes {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 8px 8px;
    font-style: italic;
}
.ts-buynote {
    font-size: 12px;
    color: var(--bull);
    padding: 8px;
    border-top: 1px solid var(--border);
    background: rgba(38,166,154,0.05);
}
.ts-no-trade {
    color: var(--text-off);
    font-size: 12px;
    padding: 12px 0;
    text-align: center;
}

/* ── Key Levels ─────────────────────────────────────────────────── */
.kl-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(26,26,26,0.8);
    position: relative;
}
.kl-row.kl-spot {
    background: rgba(41,98,255,0.06);
}
.kl-label {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.kl-value {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.kl-marker {
    color: var(--blue);
    font-size: 10px;
    position: absolute;
    right: -2px;
}
.kl-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}
.kl-insight {
    padding-top: 4px;
}
.kl-insight p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

/* ── OI Heatmap ─────────────────────────────────────────────────── */
.oi-body { padding: 0; }
table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 12px;
}
th {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    padding: 8px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 5px 8px;
    text-align: right;
    border-bottom: 1px solid #111111;
    color: var(--text);
}
.strike-col {
    text-align: center !important;
    color: var(--text-muted);
    font-weight: 600;
}
.ce-col { text-align: right; }
.pe-col { text-align: right; }
tr:hover { background: var(--bg-hover); }

/* ── Index Sells ─────────────────────────────────────────────────── */
.idx-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #111111;
}
.idx-label {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    min-width: 80px;
}
.idx-action {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--blue);
    font-weight: 600;
}
.idx-score {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
}
.idx-details {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
    padding: 2px 0 8px 92px;
}

/* ── Triggers ────────────────────────────────────────────────────── */
.trigger-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-family: var(--mono);
    font-size: 12px;
    border-bottom: 1px solid #111111;
}
.trigger-status {
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 1px 5px;
    border: 1px solid;
}
.trigger-pending .trigger-status { color: var(--warn); border-color: var(--warn); }
.trigger-fired .trigger-status { color: var(--bull); border-color: var(--bull); }
.trigger-expired .trigger-status { color: var(--text-off); border-color: var(--text-off); }
.dim { color: var(--text-off) !important; }

/* ── Stock Picks ─────────────────────────────────────────────────── */
.pick-card {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}
.pick-card:last-child { border-bottom: none; }
.pick-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.pick-sym {
    font-family: var(--font);
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.pick-bias {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border: 1px solid;
}
.pick-score {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--blue);
}
.pick-conf {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}
.pick-action {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
    margin: 4px 0;
}
.pick-levels {
    display: flex;
    gap: 16px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
}
.pick-levels b { color: var(--text); }
.pick-why {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    font-style: italic;
}

/* ── Instruments Table ───────────────────────────────────────────── */
.inst-table { font-size: 12px; }
.inst-table th {
    font-size: 12px;
    padding: 6px 6px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 1;
}
.inst-table td {
    padding: 5px 6px;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 12px;
}
.inst-sym {
    font-family: var(--font) !important;
    font-weight: 600;
    color: var(--text) !important;
}

/* ── Sectors ────────────────────────────────────────────────────── */
.sector-strip {
    display: flex;
    gap: 0;
    overflow-x: auto;
}
.sector-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-right: 1px solid var(--border);
    min-width: 90px;
}
.sector-tile:last-child { border-right: none; }
.sector-name {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 2px;
}
.sector-val {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
}

/* ── History ────────────────────────────────────────────────────── */
.history-log {
    max-height: 200px;
    overflow-y: auto;
}
.hist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 0;
    font-size: 12px;
}
.hist-border {
    width: 3px;
    height: 18px;
    border-radius: 0;
    flex-shrink: 0;
}
.hist-border-empty {
    width: 3px;
    height: 18px;
    flex-shrink: 0;
}
.hist-changed {
    background: rgba(41,98,255,0.04);
}
.hist-time {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
    min-width: 130px;
}
.hist-regime {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 12px;
    min-width: 140px;
}
.hist-detail {
    color: var(--text-muted);
    font-size: 12px;
}
.hist-empty {
    color: var(--text-off);
    text-align: center;
    padding: 16px;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════
   Aria Button + Chat Modal
   ═══════════════════════════════════════════════════════════════════ */
.aria-btn {
    background: none;
    border: 1px solid var(--blue);
    color: var(--blue);
    font-family: var(--font);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.aria-btn:hover { background: var(--blue); color: #fff; }

.chat-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw;
    height: 60vh;
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.2s, height 0.2s;
}
.chat-modal-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    cursor: default;
}
.chat-modal-controls { display: flex; gap: 4px; }
.chat-ctrl-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-off);
    width: 24px; height: 24px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-ctrl-btn:hover { color: var(--text); border-color: var(--text-muted); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.msg {
    font-size: 13px;
    line-height: 1.7;
    max-width: 92%;
    word-wrap: break-word;
}
.msg-user {
    align-self: flex-end;
    color: var(--text);
    background: #1a1f2e;
    padding: 8px 12px;
}
.msg-assistant {
    align-self: flex-start;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    padding: 4px 0;
    font-weight: 450;
}

/* Trade idea box */
.trade-box {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
    padding: 8px;
    margin: 4px 0;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Typing dots */
.typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}
.typing .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-off);
    animation: blink 1.4s infinite;
}
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
    0%,80%,100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* Chips */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 12px;
}
.chip {
    font-size: 12px;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--text-off);
    border: 1px solid var(--text-dim);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s;
}
.chip:hover {
    background: var(--border);
    color: var(--text);
}

/* Input */
.chat-input-row {
    display: flex;
    gap: 0;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
}
#chat-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    color: var(--text);
    padding: 8px 10px;
    font-family: var(--font);
    font-size: 12px;
    border-radius: 0;
    resize: none;
    outline: none;
}
#chat-input:focus { border-color: var(--blue); }
#chat-input::placeholder { color: var(--text-dim); }
.btn-clear {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-off);
    width: 30px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-clear:hover { color: var(--bear); border-color: var(--bear); }
.btn-send {
    background: var(--blue);
    border: 1px solid var(--blue);
    color: #fff;
    width: 36px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-send:hover { opacity: 0.85; }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--border); }
::-webkit-scrollbar-thumb { background: var(--text-off); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .container { grid-template-columns: 1fr; }
    .panel-row { grid-template-columns: 1fr; }
    .chat-modal { width: 95vw !important; height: 70vh !important; }
}
