* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #000000; --surface: #000000; --surface2: #080808; --border: #1a1a2e;
  --accent: #673ab7; --accent-dim: rgba(103,58,183,0.22);
  --green: #3ecf8e; --green-dim: rgba(62,207,142,0.12);
  --red: #ff5e5e; --red-dim: rgba(255,94,94,0.12);
  --gold: #f5c542; --gold-dim: rgba(245,197,66,0.12);
  --purple: #b06cf0; --purple-dim: rgba(176,108,240,0.12);
  --orange: #ff9a3c; --orange-dim: rgba(255,154,60,0.12);
  --teal: #00d4b4; --teal-dim: rgba(0,212,180,0.12);
  --text: #ffffff; --text-dim: #a0a0b8; --text-muted: #505060;
  --sidebar-w: 220px; --radius: 10px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
#sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; transition: width 0.2s ease; overflow: hidden; }
#sidebar.collapsed { width: 44px; }
#sidebar.collapsed #sidebar-header { display: none; }
#sidebar.collapsed .nav-section,
#sidebar.collapsed .nav-divider,
#sidebar.collapsed #sidebar-footer { display: none; }
#sidebar-toggle { position: fixed; left: 220px; top: 50%; transform: translate(-50%, -50%); z-index: 200; width: 14px; height: 44px; background: var(--surface2); border: 1px solid var(--border); border-radius: 0 7px 7px 0; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: left 0.2s ease, background 0.15s; }
#sidebar-toggle::before { content: '◀'; font-size: 8px; }
#sidebar.collapsed ~ #sidebar-toggle { left: 44px; }
#sidebar.collapsed ~ #sidebar-toggle::before { content: '▶'; }
#sidebar-toggle:hover { background: var(--surface); color: var(--text); }
#sidebar { position: relative; }
#sidebar-header { padding: 24px 20px 18px 20px; border-bottom: 1px solid var(--border); }
#sidebar-header .logo { font-size: 13px; font-weight: 700; letter-spacing: 2px; color: var(--accent); text-transform: uppercase; }
#sidebar-header .sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.user-menu-trigger { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 5px; padding: 2px 4px; margin-left: -4px; transition: color 0.15s; }
.user-menu-trigger:hover { color: var(--text); }
#sidebar-header { position: relative; }
#user-menu-dropdown { display: none; position: absolute; top: 100%; left: 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; min-width: 170px; z-index: 200; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.user-menu-item { padding: 10px 14px; font-size: 12px; color: var(--text-dim); cursor: pointer; transition: background 0.1s; }
.user-menu-item:hover { background: var(--border); color: var(--text); }
.user-menu-logout { color: #e08080; }
.user-menu-logout:hover { color: #ff8080; }
.nav-section { padding: 14px 12px 6px; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); padding: 0 8px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-dim); transition: all 0.15s; user-select: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-item .icon { font-size: 15px; width: 20px; text-align: center; }
.nav-item .badge { margin-left: auto; background: var(--accent-dim); color: var(--accent); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.nav-item.coming-soon { opacity: 0.38; cursor: not-allowed; }
.nav-item.coming-soon-soon { opacity: 0.6; cursor: not-allowed; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 12px; }
#sidebar-footer { margin-top: auto; padding: 14px 12px; border-top: 1px solid var(--border); }
#folder-btn { width: 100%; padding: 9px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.15s; }
#folder-btn:hover { border-color: var(--accent); color: var(--accent); }
#folder-status { font-size: 10px; color: var(--text-muted); margin-top: 6px; padding: 0 4px; line-height: 1.4; word-break: break-all; }
#folder-status.connected { color: var(--green); }

/* MAIN */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#topbar { display:none; }
#topbar h1 { font-size: 17px; font-weight: 700; }
.tab-actions { margin-left: auto; display: flex; gap: 9px; }
.btn { padding: 7px 15px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #7c4dcc; }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); }
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }
.btn-danger { background: var(--red-dim); border: 1px solid rgba(255,94,94,0.3); color: var(--red); }
.btn-danger:hover { background: rgba(255,94,94,0.22); }
.btn-edit { background: var(--gold-dim); border: 1px solid rgba(245,197,66,0.3); color: var(--gold); }
.btn-edit:hover { background: rgba(245,197,66,0.22); }
#content { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* PAGE routing */
.page { display: none; }
.page.active { display: block; }

/* VIEW SWITCHER */
.view-switcher { display: flex; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 20px; width: fit-content; }
.view-tab { padding: 6px 16px; border-radius: 7px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-dim); transition: all 0.15s; user-select: none; }
.view-tab.active { background: var(--accent); color: #fff; font-weight: 600; }
.view-tab:hover:not(.active) { color: var(--text); }

/* EDIT BANNER */
.edit-banner { display: none; background: var(--gold-dim); border: 1px solid rgba(245,197,66,0.3); border-radius: 8px; padding: 9px 14px; margin-bottom: 16px; font-size: 12.5px; color: var(--gold); align-items: center; gap: 10px; }
.edit-banner.show { display: flex; }

/* 3-COL FORM */
.form-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: start; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.form-card-title { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
label { font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 13px; padding: 8px 11px; outline: none;
  transition: border 0.15s; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
textarea { resize: vertical; min-height: 95px; line-height: 1.6; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 28px; }
.input-suffix .suffix { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--text-muted); pointer-events: none; }

/* PILL CHECKBOXES */
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-group input[type="checkbox"], .pill-group input[type="radio"] { display: none; }
.pill-group label { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface2); color: var(--text-dim); font-size: 11.5px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.pill-group label:hover { border-color: var(--accent); color: var(--text); }
.pill-group.dir input:checked + label.long-l { border-color: var(--green); background: var(--green-dim); color: var(--green); font-weight: 600; }
.pill-group.dir input:checked + label.short-l { border-color: var(--red); background: var(--red-dim); color: var(--red); font-weight: 600; }
.pill-group.cats input:checked + label.taken-l { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.pill-group.cats input:checked + label.perfect-l { border-color: var(--gold); background: var(--gold-dim); color: var(--gold); font-weight: 600; }
.pill-group.cats input:checked + label.analysis-l { border-color: var(--purple); background: var(--purple-dim); color: var(--purple); font-weight: 600; }
.pill-group.strat input:checked + label { border-color: var(--orange); background: var(--orange-dim); color: var(--orange); font-weight: 600; }
.pill-group.status input:checked + label.open-l { border-color: var(--green); background: var(--green-dim); color: var(--green); font-weight: 600; }
.pill-group.status input:checked + label.closed-l { border-color: var(--text-muted); background: rgba(255,255,255,0.05); color: var(--text-dim); font-weight: 600; }
#status-block { display: none; }
#status-block.show { display: block; }

/* TOGGLE SWITCH */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); margin-top: 4px; }
.toggle-label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.toggle-desc { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 42px; height: 23px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); border-radius: 23px; transition: 0.2s; }
.toggle-slider:before { position: absolute; content: ""; height: 17px; width: 17px; left: 3px; bottom: 3px; background: var(--text-muted); border-radius: 50%; transition: 0.2s; }
input:checked + .toggle-slider { background: var(--accent); }
input:checked + .toggle-slider:before { background: #fff; transform: translateX(19px); }

/* SCREENSHOTS */
#screenshot-zone { border: 2px dashed var(--border); border-radius: 10px; padding: 22px 14px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#screenshot-zone:hover, #screenshot-zone.dragover { border-color: var(--accent); background: rgba(79,124,255,0.04); }
#screenshot-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
#screenshot-zone .upload-icon { font-size: 22px; margin-bottom: 6px; }
#screenshot-zone .upload-text { font-size: 11.5px; color: var(--text-dim); }
#screenshot-zone .upload-sub { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
#screenshot-previews { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.preview-thumb { position: relative; width: 74px; height: 56px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-thumb .remove-btn { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,0.65); color: #fff; border: none; border-radius: 50%; width: 15px; height: 15px; font-size: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

/* TRADE LOG */
.log-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text-dim); font-size: 12px; padding: 6px 10px; outline: none; cursor: pointer; }
.filter-select:focus { border-color: var(--accent); }
.count-label { margin-left: auto; font-size: 11.5px; color: var(--text-muted); align-self: center; }
.log-section-title { font-size: 10.5px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; flex-shrink: 0; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(62,207,142,0.4)} 70%{box-shadow:0 0 0 7px rgba(62,207,142,0)} 100%{box-shadow:0 0 0 0 rgba(62,207,142,0)} }
.log-divider { height: 1px; background: var(--border); margin: 18px 0; }

/* TRADE CARDS */
.trade-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 9px; cursor: pointer; transition: all 0.15s; }
.trade-card:hover { border-color: var(--accent); }
.trade-card.open-trade { border-color: rgba(62,207,142,0.35); background: rgba(62,207,142,0.03); }
.trade-card.open-trade:hover { border-color: var(--green); }
.tc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.tc-index { font-size: 10.5px; font-weight: 700; color: var(--text-muted); font-family: monospace; min-width: 36px; }
.tc-ticker { font-size: 14px; font-weight: 700; }
.tc-date { margin-left: auto; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.tc-body { font-size: 12px; color: var(--text-dim); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-footer { display: flex; align-items: center; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.tc-profit { font-size: 11.5px; font-weight: 700; }
.tc-profit.pos { color: var(--green); } .tc-profit.neg { color: var(--red); } .tc-profit.neu { color: var(--text-muted); }

/* TAGS */
.tag { padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.tag-long { background: var(--green-dim); color: var(--green); }
.tag-short { background: var(--red-dim); color: var(--red); }
.tag-taken { background: var(--accent-dim); color: var(--accent); }
.tag-perfect { background: var(--gold-dim); color: var(--gold); }
.tag-analysis { background: var(--purple-dim); color: var(--purple); }
.tag-open { background: var(--green-dim); color: var(--green); }
.tag-closed { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.tag-sfp, .tag-pranger, .tag-nakedentry { background: var(--orange-dim); color: var(--orange); }
.tag-entry { background: var(--teal-dim); color: var(--teal); }
.tag-sysrules { background: var(--teal-dim); color: var(--teal); }
.tag-indicator { background: var(--purple-dim); color: var(--purple); }
.tag-booknotes { background: var(--gold-dim); color: var(--gold); }
.tag-setupguide { background: var(--accent-dim); color: var(--accent); }
.tag-reference { background: rgba(255,255,255,0.07); color: var(--text-dim); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }
.empty-state h3 { font-size: 14px; margin-bottom: 4px; color: var(--text-dim); }
.empty-state p { font-size: 12px; }

/* RESOURCE CARDS */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.resource-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all 0.15s; }
.resource-card:hover { border-color: var(--accent); }
.rc-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.rc-title { font-size: 14px; font-weight: 700; flex: 1; line-height: 1.3; }
.rc-eye { font-size: 13px; opacity: 0.6; flex-shrink: 0; }
.rc-body { font-size: 12px; color: var(--text-dim); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }
.rc-footer { display: flex; align-items: center; gap: 7px; }
.rc-date { margin-left: auto; font-size: 10.5px; color: var(--text-muted); }

/* RESOURCE FORM */
.resource-form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* PLACEHOLDER PAGE */
.placeholder-page { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60vh; text-align: center; gap: 12px; }
.placeholder-page .ph-icon { font-size: 48px; margin-bottom: 6px; }
.placeholder-page h2 { font-size: 20px; font-weight: 700; color: var(--text-dim); }
.placeholder-page p { font-size: 13px; color: var(--text-muted); max-width: 360px; line-height: 1.6; }
.placeholder-page .ph-badge { background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 14px; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* MODAL */
#modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 100; align-items: center; justify-content: center; padding: 24px; }
#modal-overlay.open { display: flex; }
#modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; max-width: 680px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 24px; position: relative; }
#modal-close { position: absolute; top: 13px; right: 13px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); font-size: 15px; cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
#modal-close:hover { color: var(--text); }
#modal h2 { font-size: 19px; margin-bottom: 4px; padding-right: 34px; }
.modal-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 13px; }
.modal-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.modal-section { margin-bottom: 14px; }
.modal-section-title { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.modal-section-body { font-size: 13px; line-height: 1.7; color: var(--text-dim); white-space: pre-wrap; }
.modal-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 16px; }
.stat-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.stat-box .stat-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 3px; }
.stat-box .stat-val { font-size: 15px; font-weight: 700; }
.stat-box .stat-val.pos { color: var(--green); } .stat-box .stat-val.neg { color: var(--red); }
.modal-actions { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* LIGHTBOX */
#lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 200; align-items: center; justify-content: center; }
#lightbox.open { display: flex; }
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }
#lightbox-close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 24px; cursor: pointer; opacity: 0.7; }
#lightbox-close:hover { opacity: 1; }

/* TOAST */
#toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 15px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; transform: translateY(65px); opacity: 0; transition: all 0.25s; z-index: 300; max-width: 290px; }
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); }
#toast.error { border-color: var(--red); }

::-webkit-scrollbar { width: 5px; }

/* DAILY'S */
.daily-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 9px; cursor: pointer; transition: all 0.15s; }
.daily-card:hover { border-color: var(--accent); }
.daily-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.daily-date { font-size: 13px; font-weight: 700; color: var(--text); }
.daily-session-badge { padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 600; }
.daily-session-badge.morning { background: var(--gold-dim); color: var(--gold); }
.daily-session-badge.eod { background: var(--teal-dim); color: var(--teal); }
.daily-preview { font-size: 12px; color: var(--text-dim); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* PERFECT TRADES */
.perfect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.perfect-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all 0.15s; }
.perfect-card:hover { border-color: var(--gold); box-shadow: 0 0 12px rgba(245,197,66,0.1); }
.perfect-card-img { width: 100%; height: 155px; object-fit: cover; display: block; cursor: zoom-in; }
.perfect-card-body { padding: 13px; }
.perfect-card-index { font-size: 10px; font-weight: 700; color: var(--text-muted); font-family: monospace; letter-spacing: 1px; }
.perfect-card-symbol { font-size: 15px; font-weight: 700; color: var(--gold); margin: 4px 0; }
.perfect-card-date { font-size: 10.5px; color: var(--text-muted); margin-bottom: 7px; }
.perfect-card-why { font-size: 12px; color: var(--text-dim); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ANALYTICS */
.analytics-controls { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; }
.analytics-controls .ctrl-group { display: flex; flex-direction: column; gap: 5px; }
.analytics-controls .ctrl-group label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.analytics-controls .ctrl-group input, .analytics-controls .ctrl-group select { padding: 7px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; color: var(--text); font-size: 12px; outline: none; }
.analytics-controls .ctrl-group input:focus, .analytics-controls .ctrl-group select:focus { border-color: var(--accent); }
.analytics-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
.a-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-align: center; }
.a-stat-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 6px; }
.a-stat-val { font-size: 22px; font-weight: 700; color: var(--accent); }
.a-stat-val.pos { color: var(--green); } .a-stat-val.neg { color: var(--red); }
.analytics-chart-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.analytics-chart-wrap canvas { max-height: 380px; }

/* DISCORD BRIEFING */
.discord-setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.discord-toggle-btn { background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 0; }
.discord-steps-list { margin-top: 14px; list-style: none; counter-reset: dc-step; display: flex; flex-direction: column; gap: 12px; }
.discord-steps-list li { counter-increment: dc-step; display: flex; gap: 12px; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.discord-steps-list li::before { content: counter(dc-step); display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: var(--accent-dim); color: var(--accent); border-radius: 50%; font-weight: 700; font-size: 11px; flex-shrink: 0; margin-top: 1px; }
.discord-steps-list code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-family: monospace; font-size: 11px; color: var(--orange); }
.discord-import-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.discord-import-card label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; margin-top: 14px; }
.discord-import-card label:first-of-type { margin-top: 0; }
.discord-import-card input, .discord-import-card textarea { width: 100%; padding: 8px 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); font-size: 13px; font-family: inherit; outline: none; }
.discord-import-card input:focus, .discord-import-card textarea:focus { border-color: var(--accent); }
.discord-import-card textarea { min-height: 180px; resize: vertical; line-height: 1.55; }
.discord-result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: none; }
.discord-result-card.show { display: block; }
.discord-result-title { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.discord-result-body { font-size: 13px; line-height: 1.65; color: var(--text-dim); white-space: pre-wrap; }
::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── CHARTS PAGE ─────────────────────────────────────────── */
#page-charts { display:none; flex-direction:column; height:calc(100vh - 54px); padding:0; overflow:hidden; position:relative; }
#page-charts.active { display:flex; }
#chart-toolbar { display:flex; align-items:center; gap:14px; padding:8px 14px; background:#000000; border-bottom:1px solid var(--border); flex-shrink:0; flex-wrap:wrap; position:relative; }
.chart-tb-group { display:flex; align-items:center; gap:7px; }
.chart-tb-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); }
.chart-tb-hint { font-size:10px; color:var(--text-muted); }
#chart-symbol-input { background:var(--surface2); border:1px solid var(--border); border-radius:6px; color:var(--text); font-size:13px; font-weight:700; padding:5px 10px; width:110px; outline:none; font-family:monospace; text-transform:uppercase; }
#chart-symbol-input:focus { border-color:var(--accent); }
/* ── Watchlist combo button + floating panel ── */
.watchlist-combo { position:relative; }
.watchlist-combo-btn {
  display:flex; align-items:center;
  background:var(--surface2); border:1px solid var(--border); border-radius:6px;
  color:var(--text); font-size:13px; font-weight:700; padding:5px 10px;
  font-family:monospace; cursor:pointer; white-space:nowrap; min-width:110px;
  transition:border-color .15s;
}
.watchlist-combo-btn:hover { border-color:var(--accent); }
.watchlist-combo-panel {
  display:none; position:absolute; top:calc(100% + 6px); left:0;
  background:var(--surface2); border:1px solid var(--border); border-radius:8px;
  width:210px; z-index:300; box-shadow:0 8px 28px rgba(0,0,0,0.7);
  overflow:hidden;
}
.watchlist-ex-row {
  display:flex; flex-wrap:wrap; gap:4px;
  padding:6px 8px; border-bottom:1px solid var(--border);
}
.watchlist-combo-panel.open { display:block; }
.watchlist-combo-search-wrap { padding:8px 8px 6px; border-bottom:1px solid var(--border); }
.watchlist-combo-input {
  width:100%; box-sizing:border-box;
  background:rgba(255,255,255,0.06); border:1px solid var(--border); border-radius:5px;
  color:var(--text); font-size:12px; font-family:monospace; font-weight:600;
  padding:5px 8px; outline:none; text-transform:uppercase;
}
.watchlist-combo-input:focus { border-color:var(--accent); }
.watchlist-combo-list { max-height:200px; overflow-y:auto; padding:4px 0; }
.watchlist-combo-item {
  padding:6px 12px; font-size:12px; font-family:monospace; font-weight:600;
  color:var(--text); cursor:pointer; white-space:nowrap;
  transition:background .1s;
}
.watchlist-combo-item:hover { background:rgba(255,255,255,0.07); }
.watchlist-combo-item.active { color:var(--accent); }
.watchlist-combo-empty { padding:8px 12px; font-size:11px; color:var(--text-muted); }
.watchlist-combo-footer { padding:6px 8px 8px; border-top:1px solid var(--border); }
.watchlist-combo-remove {
  width:100%; padding:6px 0; background:rgba(255,94,94,0.1);
  border:1px solid rgba(255,94,94,0.35); border-radius:5px;
  color:#ff5e5e; font-size:11px; font-weight:600; cursor:pointer;
}
.watchlist-combo-remove:hover { background:rgba(255,94,94,0.22); }
/* Symbol input inside toolbar (now inside combo panel — override width) */
#chart-symbol-input { background:transparent; border:none; padding:0; width:100%; outline:none; }
.chart-watchlist-remove-btn { display:none; } /* legacy; replaced by combo */
.chart-tb-btn { background:#673ab7; color:#fff; border:none; border-radius:6px; padding:5px 12px; font-size:12px; font-weight:600; cursor:pointer; }
.chart-tb-btn:hover { opacity:0.85; }
.chart-tf-badge { background:var(--accent-dim); color:var(--accent); font-size:12px; font-weight:700; padding:3px 10px; border-radius:5px; font-family:monospace; min-width:36px; text-align:center; }
.tpo-tf-select { margin-left:8px; font-size:11px; font-weight:700; color:var(--accent); background:transparent; border:none; cursor:pointer; min-width:40px; font-family:monospace; opacity:0.8; }
.tpo-tf-select:focus { outline:none; }
.chart-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.chart-dot-on { background:var(--green); box-shadow:0 0 6px var(--green); }
.chart-dot-off { background:var(--text-muted); }
.chart-dot-err { background:var(--red); }
/* Indicator dropdown */
.chart-ind-wrap { position:relative; }
.chart-ind-menu { position:absolute; top:calc(100% + 6px); left:0; background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:6px; min-width:210px; width:auto; z-index:200; box-shadow:0 8px 24px rgba(0,0,0,0.6); display:none; }
.chart-ind-menu.open { display:block; }
/* Chart Settings and TPO menus: fixed width + scrollable */
#chart-settings-menu { width:260px; max-height:calc(100vh - 80px); overflow-y:auto; }
#tpo-settings-menu   { width:280px; max-height:calc(100vh - 80px); overflow-y:auto; }
#tpo-profiles-menu   { width:320px; max-height:calc(100vh - 80px); overflow-y:auto; }
.chart-ind-item { display:flex; align-items:flex-start; flex-direction:column; padding:6px 10px; border-radius:6px; cursor:pointer; gap:1px; user-select:none; }
.chart-ind-item:hover { background:var(--surface); }
.chart-ind-row { display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--text); width:100%; }
.chart-ind-row input[type=checkbox] { accent-color:var(--accent); width:13px; height:13px; cursor:pointer; margin:0; }
.chart-ind-desc { font-size:10px; color:var(--text-muted); padding-left:20px; }
.ind-divider { height:1px; background:var(--border); margin:4px 2px; }

/* ── Indicator settings gear button ─────────────────────────── */
.ind-settings-btn {
  margin-left:auto;
  background:none; border:none; padding:4px 10px; border-radius:5px;
  color:var(--text-dim); font-size:13px; cursor:pointer; line-height:1;
  transition:color 0.15s, background 0.15s;
  flex-shrink:0; font-weight:600;
}
.ind-settings-btn:hover { color:var(--accent); background:var(--accent-dim); }

/* ── Indicator settings side panel ──────────────────────────── */
.ind-settings-panel {
  position:absolute;
  top:0; left:calc(100% + 8px);
  width:220px;
  background:var(--surface2); border:1px solid var(--border); border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,0.65);
  z-index:201;
  display:none;
  overflow:hidden;
}
.ind-settings-panel.open { display:block; }

.ind-settings-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 10px; border-bottom:1px solid var(--border);
  font-size:11.5px; font-weight:700; color:var(--text);
  text-transform:uppercase; letter-spacing:0.8px;
}
.ind-settings-close {
  background:none; border:none; color:var(--text-muted);
  font-size:12px; cursor:pointer; padding:2px 5px; border-radius:4px; line-height:1;
}
.ind-settings-close:hover { color:var(--text); background:var(--surface); }

.ind-settings-body { padding:10px; display:flex; flex-direction:column; gap:6px; }

.ind-set-row {
  display:flex; align-items:center; gap:8px;
  font-size:12px; color:var(--text-dim);
}
.ind-set-label { flex:1; }
.ind-set-val { font-weight:600; color:var(--accent); font-size:11px; min-width:32px; text-align:right; }
.ind-set-color {
  width:28px; height:22px; border:1px solid var(--border); border-radius:5px;
  background:none; cursor:pointer; padding:1px;
}
.ind-set-range {
  width:100%; accent-color:var(--accent); cursor:pointer; margin:2px 0;
}
.ind-set-num {
  width:52px; background:var(--surface); border:1px solid var(--border);
  border-radius:5px; color:var(--text); font-size:12px; padding:3px 5px;
  text-align:right;
}
.ind-set-num:focus { outline:none; border-color:var(--accent); }
/* Alpha % input that sits inline next to a color swatch */
.color-alpha-num {
  width:34px; background:var(--surface); border:1px solid var(--border);
  border-radius:5px; color:var(--text); font-size:11px; padding:2px 3px;
  text-align:right;
}
.color-alpha-num:focus { outline:none; border-color:var(--accent); }
.ind-set-note {
  font-size:10px; color:var(--text-muted); margin-top:2px; line-height:1.4;
}
.ind-set-unit { font-size:10px; color:var(--text-muted); }
/* Chart layout */
#chart-body { display:flex; flex-direction:column; flex:1; overflow:hidden; position:relative; }
#chart-main-wrap { flex:1; position:relative; overflow:hidden; background:#000000; cursor:crosshair; }
#chart-canvas { display:block; }
#chart-rsi-wrap { flex-shrink:0; height:146px; position:relative; background:#000000; border-top:1px solid rgba(255,255,255,0.1); display:none; }
#chart-rsi-wrap.visible { display:block; }
#chart-rsi-canvas { display:block; }
/* Y-axis cursor zone */
#chart-main-wrap.on-yaxis { cursor:ns-resize; }
#chart-main-wrap.on-xaxis { cursor:ew-resize; }
/* ── CHART LOADING OVERLAY ───────────────────────────────── */
#chart-loading-overlay {
  display:none; position:absolute; top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,0.97); z-index:20;
  flex-direction:column; align-items:center; justify-content:center; gap:16px;
}
#chart-loading-overlay.visible { display:flex; }
.chart-load-title { font-size:15px; font-weight:700; color:var(--text); letter-spacing:0.3px; }
.chart-load-bar-bg { width:300px; height:5px; background:var(--border); border-radius:3px; overflow:hidden; }
#chart-loading-bar-fill { height:100%; width:0%; background:var(--accent); border-radius:3px; transition:width 0.2s ease; }
.chart-load-sub { font-size:11.5px; color:var(--text-muted); font-family:monospace; min-height:16px; }
.chart-load-count { font-size:11px; color:var(--text-dim); }
/* Status bar */
#chart-statusbar { display:flex; align-items:center; gap:16px; padding:5px 14px; background:var(--surface); border-top:1px solid var(--border); flex-shrink:0; font-size:11.5px; font-family:monospace; }
#csb-last { color:var(--text); font-weight:700; font-size:13px; }
#csb-change { font-weight:600; }
#csb-high { color:var(--green); }
#csb-low { color:var(--red); }
#csb-vol, #csb-spread { color:var(--text-dim); }

.ind-set-select {
  background:var(--surface); border:1px solid var(--border); border-radius:5px;
  color:var(--text); font-size:12px; padding:2px 5px; cursor:pointer;
  max-width:120px;
}
.ind-set-select:focus { outline:none; border-color:var(--accent); }

/* ── DRAWING TOOLS ────────────────────────────────────────── */
.chart-draw-wrap { position:relative; }
.draw-section-title {
  padding:6px 10px 3px;
  font-size:9px; font-weight:700; letter-spacing:1.2px; text-transform:uppercase;
  color:rgba(255,255,255,0.35);
}
.draw-tool-item {
  display:flex; align-items:center; gap:8px;
  padding:7px 10px; border-radius:6px; cursor:pointer;
  font-size:12px; color:rgba(255,255,255,0.75);
  transition:all 0.12s; user-select:none;
}
.draw-tool-item:hover { background:rgba(255,255,255,0.06); color:#fff; }
.draw-tool-item.active { background:var(--accent-dim); color:var(--accent); font-weight:600; }
.draw-tool-icon { width:18px; text-align:center; font-size:13px; flex-shrink:0; }
.draw-placed-item {
  display:flex; align-items:center; gap:4px;
  padding:5px 10px; border-radius:6px;
  font-size:11.5px; color:rgba(255,255,255,0.7);
}
.draw-placed-icon { width:18px; text-align:center; font-size:12px; opacity:0.6; flex-shrink:0; }
.draw-placed-label { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11.5px; }
.draw-delete-btn {
  background:none; border:none; cursor:pointer;
  color:rgba(255,94,94,0.55); font-size:13px;
  padding:2px 4px; border-radius:4px;
  transition:all 0.12s; line-height:1; flex-shrink:0;
}
.draw-delete-btn:hover { color:var(--red); background:var(--red-dim); }
.draw-empty-note {
  padding:8px 12px 8px;
  font-size:11px; color:rgba(255,255,255,0.28);
  line-height:1.55; font-style:italic;
}

/* ── TPO Profiles menu — clean profile rows (matches Drawing Tools style) ── */
.tpo-profile-row {
  display:flex; align-items:center; gap:7px;
  padding:5px 8px; border-radius:6px; cursor:default;
  user-select:none;
}
.tpo-profile-row:hover { background:var(--surface); }
.tpo-profile-row-label {
  flex:1; font-size:12px; color:var(--text);
}
.tpo-profile-row-tf {
  font-size:10px; color:rgba(255,255,255,0.45);
  background:rgba(255,255,255,0.06); border-radius:3px;
  padding:1px 5px; min-width:28px; text-align:center; white-space:nowrap;
}

/* ── Combined Profile Row [Fixed Range] [VP] [TPO] ── */
.draw-profile-row {
  display:flex; align-items:center; gap:4px;
  padding:5px 8px 5px;
}
.draw-profile-btn {
  flex:1; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.1);
  border-radius:5px; color:rgba(255,255,255,0.7); font-size:11px; font-weight:500;
  padding:5px 6px; cursor:pointer; text-align:center;
  transition:all 0.12s; white-space:nowrap; user-select:none;
}
.draw-profile-btn:hover { background:rgba(255,255,255,0.1); color:#fff; border-color:rgba(255,255,255,0.22); }
.draw-profile-btn-active { background:var(--accent-dim)!important; color:var(--accent)!important; border-color:var(--accent)!important; font-weight:600; }

/* ── Tool-defaults settings button (⚙ in Drawing Tools list) ── */
.draw-tool-settings-btn {
  background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,0.25); font-size:12px;
  padding:2px 5px; border-radius:4px;
  transition:all 0.12s; line-height:1; flex-shrink:0;
  margin-left:auto;
}
.draw-tool-settings-btn:hover { color:var(--accent); background:var(--accent-dim); }

/* ── Inline defaults flyout inside the Drawing Tools dropdown ── */
.draw-defaults-flyout {
  display:none;
  background:rgba(34,38,58,0.97);
  border-radius:6px;
  margin:0 6px 4px;
  padding:7px 9px;
  border:1px solid var(--border);
  max-height:320px;
  overflow-y:auto;
}
.draw-defaults-flyout.open { display:block; }

/* ── Section dividers inside settings panels ── */
.draw-set-section {
  font-size:9px; font-weight:700; letter-spacing:1.2px;
  text-transform:uppercase; color:rgba(255,255,255,0.32);
  padding:7px 0 3px; margin-top:2px;
  border-top:1px solid rgba(255,255,255,0.07);
}
.draw-set-section:first-child { border-top:none; padding-top:2px; margin-top:0; }

/* ── Fib level rows ── */
.draw-fib-row {
  display:flex; align-items:center; gap:5px;
  padding:2px 0; font-size:11px;
  color:rgba(255,255,255,0.65);
}
.draw-fib-row input[type="checkbox"] { flex-shrink:0; cursor:pointer; }

/* ── Floating per-drawing edit panel ── */
.draw-edit-panel {
  position:fixed; z-index:9999;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:8px;
  box-shadow:0 10px 40px rgba(0,0,0,0.65);
  width:270px;
  max-height:82vh;
  overflow-y:auto;
  font-size:11.5px;
}
.draw-edit-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  font-size:12px; font-weight:600; color:var(--text);
  background:var(--surface2);
  border-radius:8px 8px 0 0;
}
.draw-edit-body { padding:8px 10px; display:flex; flex-direction:column; gap:5px; }

/* ── Hide setting descriptions (shown as tooltips instead) ── */
.ind-set-note { display:none !important; }

/* ── 3-second hover tooltip ── */
#bb-tooltip {
  position:fixed; z-index:99999;
  background:rgba(20,22,35,0.97);
  border:1px solid rgba(79,124,255,0.4);
  border-radius:6px;
  padding:7px 10px;
  font-size:11.5px; color:rgba(255,255,255,0.88);
  max-width:220px; line-height:1.45;
  pointer-events:none;
  display:none;
  box-shadow:0 4px 16px rgba(0,0,0,0.55);
}
#bb-tooltip.show { display:block; }

/* ── MACRO SETTINGS PANEL ────────────────────────────────────── */
.macro-title-btn {
  cursor:pointer; user-select:none;
  transition:color 0.15s;
  display:inline-flex; align-items:center; gap:4px;
}
.macro-title-btn:hover { color:var(--accent) !important; }

#macro-settings-panel {
  position:fixed; z-index:9999;
  background:#000000;
  border:1px solid var(--accent);
  border-radius:10px;
  box-shadow:0 10px 40px rgba(103,58,183,0.35);
  width:260px;
  font-size:12px;
  overflow:hidden;
}
#macro-settings-panel .msp-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:9px 12px;
  border-bottom:1px solid var(--border);
  font-size:12px; font-weight:700; color:var(--text);
  background:rgba(103,58,183,0.12);
  cursor:move; user-select:none;
  letter-spacing:0.6px; text-transform:uppercase;
}
#macro-settings-panel .msp-close {
  background:none; border:none; color:var(--text-muted);
  font-size:13px; cursor:pointer; padding:2px 6px; border-radius:4px; line-height:1;
}
#macro-settings-panel .msp-close:hover { color:var(--text); background:var(--surface2); }
#macro-settings-panel .msp-body {
  padding:12px; display:flex; flex-direction:column; gap:10px;
}
.msp-row {
  display:flex; align-items:center; gap:8px;
  font-size:12px; color:var(--text-dim);
}
.msp-label { flex:1; }
.msp-color {
  width:32px; height:24px; border:1px solid var(--border); border-radius:5px;
  background:none; cursor:pointer; padding:1px;
}
.msp-reset {
  width:100%; padding:7px; background:var(--surface2); border:1px solid var(--border);
  border-radius:6px; color:var(--text-muted); font-size:11px; cursor:pointer;
  transition:all 0.15s; margin-top:2px;
}
.msp-reset:hover { border-color:var(--accent); color:var(--accent); }

/* ══════════════════════════════════════════════════════════════
   MARKET INTEL PAGE
   ══════════════════════════════════════════════════════════════ */

/* Header bar */
.mi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mi-header-left { display: flex; align-items: center; gap: 10px; }
.mi-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.4s;
}
.mi-status-text { font-size: 11.5px; color: var(--text-muted); }
.mi-refresh-btn { font-size: 11.5px; padding: 6px 13px; }

/* API Keys accordion */
.mi-keys-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.mi-keys-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  user-select: none;
  transition: background 0.15s;
}
.mi-keys-toggle:hover { background: rgba(255,255,255,0.025); color: var(--text); }
#mi-keys-arrow { font-size: 10px; color: var(--text-muted); width: 10px; flex-shrink: 0; }
.mi-keys-sub {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 400;
}
.mi-keys-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
}
.mi-key-field { display: flex; flex-direction: column; gap: 5px; }
.mi-key-field label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.mi-key-input-row { display: flex; gap: 7px; }
.mi-key-input-row input { flex: 1; font-size: 12px; padding: 7px 11px; }
.mi-key-hint { font-size: 10px; color: var(--text-muted); }
.mi-key-hint a { color: var(--accent); text-decoration: none; }
.mi-key-hint a:hover { text-decoration: underline; }

/* Card grid — 3 columns; .mi-card-lg spans 2 */
.mi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.mi-card-lg { grid-column: span 2; }

/* Card shell */
.mi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.mi-card:hover { border-color: rgba(103,58,183,0.3); }

.mi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mi-card-title { font-size: 12px; font-weight: 700; color: var(--text); }
.mi-card-source {
  font-size: 9px;
  color: var(--text-muted);
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mi-card-body { padding: 14px; flex: 1; min-height: 110px; }
.mi-card-note {
  font-size: 9.5px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.4;
}

/* State indicators */
.mi-loading, .mi-error, .mi-nokey, .mi-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.mi-error  { color: var(--red); }
.mi-nokey  { color: var(--text-muted); }
.mi-nokey  strong { color: var(--gold); }

/* Spinner */
.mi-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mi-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes mi-spin { to { transform: rotate(360deg); } }

/* ── Fear & Greed ── */
.mi-fg-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.mi-fg-info { display: flex; flex-direction: column; gap: 3px; }
.mi-fg-value { font-size: 38px; font-weight: 800; line-height: 1; }
.mi-fg-label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.mi-fg-sub   { font-size: 10px; color: var(--text-muted); }

.mi-fng-history {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 52px;
}
.mi-fng-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 3px;
  cursor: default;
}
.mi-fng-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: opacity 0.15s;
}
.mi-fng-bar-wrap:hover .mi-fng-bar { opacity: 0.7; }
.mi-fng-bar-label { font-size: 9px; color: var(--text-muted); font-weight: 600; }

/* ── Stats (TVL, ETF) ── */
.mi-stat-main  { margin-bottom: 12px; }
.mi-stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.15; }
.mi-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.mi-stat-change { font-size: 12px; font-weight: 600; margin-top: 5px; }
.mi-stat-sub-header { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.mi-sparkline { display: block; width: 100%; }

/* ── Stablecoins table ── */
.mi-table { display: flex; flex-direction: column; gap: 3px; }
.mi-table-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11.5px;
}
.mi-table-row:hover { background: var(--surface2); }
.mi-table-header {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3px;
}
.mi-table-name  { min-width: 52px; font-weight: 700; }
.mi-table-exch  { flex: 1; text-align: center; font-family: monospace; font-size: 11px; }
.mi-table-val   { flex: 1; text-align: right; font-family: monospace; }
.mi-table-pct   { min-width: 42px; text-align: right; color: var(--text-muted); font-size: 10.5px; }

.mi-stab-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.mi-stab-bar {
  height: 100%;
  background: var(--teal);
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.mi-table-row:hover .mi-stab-bar { opacity: 1; }

/* ── Open Interest ── */
.mi-oi-list { display: flex; flex-direction: column; gap: 8px; }
.mi-oi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mi-oi-sym  { font-size: 13px; font-weight: 700; color: var(--gold); min-width: 46px; }
.mi-oi-val  { font-size: 13px; font-weight: 600; font-family: monospace; }
.mi-oi-chg  { font-size: 12px; font-weight: 600; min-width: 64px; text-align: right; }

/* ── Macro Calendar ── */
.mi-event-list { display: flex; flex-direction: column; }
.mi-event-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.mi-event-row:last-child { border-bottom: none; }
.mi-event-dot  { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.mi-event-info { flex: 1; }
.mi-event-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.mi-event-meta { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.mi-event-est  { font-size: 10.5px; color: var(--teal); font-family: monospace; white-space: nowrap; }

/* ── Whale Alert ── */
.mi-whale-list { display: flex; flex-direction: column; gap: 6px; }
.mi-whale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.mi-whale-left  { display: flex; align-items: center; gap: 9px; }
.mi-whale-right { display: flex; align-items: center; gap: 9px; }
.mi-whale-sym   { font-size: 13px; font-weight: 700; color: var(--gold); }
.mi-whale-usd   { font-size: 12px; font-weight: 600; font-family: monospace; }
.mi-whale-flow  { font-size: 11px; font-weight: 600; }
.mi-whale-time  { font-size: 10px; color: var(--text-muted); }

/* ── GDELT News ── */
.mi-news-list { display: flex; flex-direction: column; gap: 2px; }
.mi-news-row {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}
.mi-news-row:hover { background: var(--surface2); }
.mi-news-title {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 3px;
}
.mi-news-meta { font-size: 10px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   BENTON CHARTS — PREREQUISITES GATE MODAL
   ══════════════════════════════════════════════════════════════ */
#chart-prereq-modal {
  position: absolute;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chart-prereq-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#chart-prereq-box {
  position: relative;
  z-index: 1;
  background: #0a0a12;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 36px 28px;
  width: 440px;
  max-width: calc(100vw - 48px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
}

#chart-prereq-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

#chart-prereq-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

#chart-prereq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.prereq-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.prereq-row:last-child { border-bottom: none; }
.prereq-row.prereq-ok  { background: rgba(62,207,142,0.05); }
.prereq-row.prereq-err { background: rgba(255,94,94,0.05); }

.prereq-icon-wrap {
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.prereq-icon { font-size: 16px; line-height: 1; }

.prereq-info { flex: 1; min-width: 0; }

.prereq-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
}

.prereq-desc { font-size: 11px; color: var(--text-muted); }

.prereq-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  letter-spacing: 0.02em;
  transition: all 0.2s;
}
.prereq-badge.ok  { background: var(--green-dim); border-color: rgba(62,207,142,0.3); color: var(--green); }
.prereq-badge.err { background: var(--red-dim);   border-color: rgba(255,94,94,0.3);  color: var(--red); }

#prereq-vpn-toggle {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
#prereq-vpn-toggle.vpn-on {
  background: var(--green-dim);
  border-color: rgba(62,207,142,0.35);
  color: var(--green);
}

/* Exchange selector buttons */
.prereq-exchange-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.prereq-exchange-btn:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text);
}
.prereq-exchange-btn.prereq-exchange-active {
  background: var(--green-dim);
  border-color: rgba(62,207,142,0.4);
  color: var(--green);
}

#chart-prereq-actions { display: flex; flex-direction: column; gap: 8px; }

#prereq-check-btn {
  width: 100%;
  padding: 11px 0;
  background: var(--green);
  border: none;
  border-radius: 9px;
  color: #000;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: opacity 0.15s;
}
#prereq-check-btn:hover,
#tpo-prereq-check-btn:hover { opacity: 0.88; }
#prereq-check-btn:disabled,
#tpo-prereq-check-btn:disabled { opacity: 0.35; cursor: not-allowed; }
#tpo-prereq-check-btn { width:100%; padding:11px 0; background:var(--green); border:none; border-radius:9px; color:#000; font-size:13px; font-weight:700; cursor:pointer; letter-spacing:0.03em; transition:opacity 0.15s; }

#prereq-error-msg {
  font-size: 11.5px;
  color: var(--red);
  text-align: center;
  min-height: 16px;
}

/* ══════════════════════════════════════════════════════════════
   BENTON TPO™ PAGE LAYOUT
   Mirrors #page-charts so the canvas stays locked in place
   and the toolbar dropdowns position correctly.
   ══════════════════════════════════════════════════════════════ */
#page-tpo { display:none; flex-direction:column; height:calc(100vh - 54px); padding:0; overflow:hidden; position:relative; }
#page-tpo.active { display:flex; }
#tpo-toolbar { display:flex; align-items:center; gap:14px; padding:8px 14px; background:#000000; border-bottom:1px solid var(--border); flex-shrink:0; flex-wrap:wrap; position:relative; }
#tpo-body { display:flex; flex-direction:column; flex:1; overflow:hidden; position:relative; }
#tpo-main-wrap { flex:1; position:relative; overflow:hidden; background:#000000; cursor:crosshair; }
#tpo-canvas { display:block; }
#tpo-loading-overlay { display:none; position:absolute; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.97); z-index:20; flex-direction:column; align-items:center; justify-content:center; gap:16px; }
#tpo-loading-overlay.visible { display:flex; }
#tpo-statusbar { display:flex; align-items:center; gap:16px; padding:5px 14px; background:var(--surface); border-top:1px solid var(--border); flex-shrink:0; font-size:11.5px; font-family:monospace; }

/* ── Debug Log ─────────────────────────────────────── */
#debug-log-box {
  background: var(--surface, #16161c);
  border: 1px solid var(--border, #2a2a36);
  border-radius: 12px;
  width: 780px; max-width: 95vw;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}
#debug-log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#debug-log-list {
  flex: 1; overflow-y: auto; font-family: monospace; font-size: 11px;
  padding: 6px 0; background: #0d0d11;
}
#debug-log-footer {
  padding: 6px 14px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.debug-log-row {
  display: flex; gap: 8px; align-items: baseline;
  padding: 3px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  line-height: 1.5; word-break: break-all;
}
.debug-log-row:hover { background: rgba(255,255,255,0.04); }
.debug-log-time  { color: #555; font-size: 10px; white-space: nowrap; flex-shrink: 0; }
.debug-log-level { font-size: 10px; font-weight: 700; white-space: nowrap; flex-shrink: 0; min-width: 42px; }
.debug-log-msg   { color: #ccc; }
.debug-filter-btn {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.debug-filter-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.debug-filter-btn.active { background: rgba(124,106,245,0.18); border-color: var(--accent); color: var(--accent); }
.debug-action-btn {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.debug-action-btn:hover { color: var(--text); }
.debug-close-btn { padding: 3px 8px; }

