:root {
  --bg: #0b0e14;
  --bg-2: #11151f;
  --panel: #151b28;
  --panel-2: #1b2333;
  --border: #232c3d;
  --text: #e6ebf4;
  --text-dim: #8a97ad;
  --text-faint: #5c6880;
  --accent: #f7b733;       /* gold */
  --accent-2: #ffd270;
  --green: #3ad29f;
  --red: #f0616d;
  --blue: #5aa9ff;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2233 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1480px; margin: 0 auto; padding: 22px 26px 60px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #e0922b);
  color: #1a1205; font-weight: 800; font-size: 18px; letter-spacing: 0.5px;
  box-shadow: 0 6px 18px rgba(247, 183, 51, 0.3);
}
.brand-text h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.brand-text p { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

.main-nav { display: flex; align-items: center; gap: 6px; margin-right: auto; margin-left: 24px; }
.nav-link {
  padding: 8px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  color: var(--text-dim); text-decoration: none; border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.active {
  color: var(--accent); background: rgba(247, 183, 51, 0.1);
  border-color: rgba(247, 183, 51, 0.25);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* --- track panel (drawer) --- */
.track-panel {
  margin: 16px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border);
}
.track-head { display: flex; align-items: center; justify-content: space-between; }
.track-head h3 { font-size: 14px; font-weight: 600; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.track-form { margin-top: 14px; }
.track-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.track-grid label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--text-dim);
}
.track-grid label.track-notes { grid-column: 1 / -1; }
.track-grid label.track-check {
  grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px;
  color: var(--text-dim); cursor: pointer;
}
.track-grid label.track-check input { width: 16px; height: 16px; flex: none; }
.track-grid input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; color: var(--text); font-size: 13.5px; font-family: inherit;
}
.track-grid input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(247,183,51,0.12); }
.track-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px;
}
.track-hint { font-size: 12px; color: var(--text-dim); }
.track-hint.ok { color: var(--green); }
.track-hint.err { color: var(--red); }

/* --- live spread panel (drawer) --- */
.spread-panel { border-color: rgba(90,169,255,0.22); }
.spread-hint { font-size: 12px; color: var(--text-dim); margin: 8px 0 12px; line-height: 1.45; }
.spread-grid { margin-bottom: 0; }
.spread-btns { display: flex; gap: 8px; }
.spread-stale {
  font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: rgba(247,183,51,0.14); color: var(--accent);
}

/* --- My Trades page --- */
.notif-banner {
  padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 18px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-dim);
}
.notif-banner.warn { border-color: rgba(240,97,109,0.35); background: rgba(240,97,109,0.08); color: var(--text); }
.alert-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.alert-badge.drop { background: rgba(240,97,109,0.16); color: var(--red); }
.alert-badge.sell { background: rgba(58,210,159,0.16); color: var(--green); }
.alert-badge.past { background: rgba(247,183,51,0.18); color: var(--accent); }
.alert-badge.none { background: var(--bg-2); color: var(--text-faint); }
.status-badge {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.status-badge.holding { background: rgba(58,210,159,0.16); color: var(--green); }
.status-badge.pending { background: rgba(90,169,255,0.14); color: var(--blue); }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-left: 6px; }
.empty { text-align: center; color: var(--text-dim); padding: 26px 16px; font-size: 13.5px; }

/* --- Add trade modal --- */
.add-search { position: relative; margin-bottom: 16px; }
.add-search input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 12px 14px; border-radius: 10px; font-size: 14px;
  font-family: inherit;
}
.add-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(247,183,51,0.12); }
.add-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  max-height: 280px; overflow-y: auto; box-shadow: var(--shadow);
}
.add-result {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  cursor: pointer; border-bottom: 1px solid rgba(35,44,61,0.5); font-size: 13.5px;
}
.add-result:last-child { border-bottom: none; }
.add-result:hover { background: rgba(247,183,51,0.08); }
.add-result img { width: 26px; height: 26px; object-fit: contain; }
.add-result .ar-name { flex: 1; color: var(--text); }
.add-result .ar-price { font-family: var(--mono); color: var(--text-dim); font-size: 12.5px; }
.add-result.empty-result { color: var(--text-dim); cursor: default; justify-content: center; }
.add-selected {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--bg); border: 1px solid rgba(247,183,51,0.3); border-radius: 10px;
  margin-bottom: 16px;
}
.add-selected img { width: 34px; height: 34px; object-fit: contain; }
.add-sel-text { display: flex; flex-direction: column; gap: 3px; flex: 1; }
#add-sel-name { font-size: 14.5px; font-weight: 600; }
.add-sel-meta { font-size: 12px; color: var(--text-dim); }
.add-fields { margin-bottom: 4px; }
.modal-actions .track-hint { margin-right: auto; }

/* --- trade detail drawer --- */
.position-block, .potential-block {
  margin: 16px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border);
}
.potential-block { border-color: rgba(58,210,159,0.25); }

.trade-preview {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border);
}
.trade-preview-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 4px 0; font-size: 13px;
}
.trade-preview-label { color: var(--text-dim); }
.trade-preview-value { font-family: var(--mono); font-weight: 700; }
.trade-preview-hint { margin-top: 6px; font-size: 11px; color: var(--text-faint); }
.position-block .drawer-strategy-head, .potential-block .drawer-strategy-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.position-block h3, .potential-block h3 { font-size: 14px; font-weight: 600; }
.sub-roi { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 9px 16px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--panel-2); border-color: #2f3a4f; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #e7a52e);
  color: #1a1205; border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.btn-icon { padding: 9px 12px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { border-color: rgba(240,97,109,0.4); color: var(--red); }
.btn-danger:hover { background: rgba(240,97,109,0.12); border-color: var(--red); }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 11px; }

/* ---------- Account control (topbar) ---------- */
.account-menu { position: relative; }
.account-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 220px; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.account-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 0.3px; padding: 2px 6px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #1a1205;
}
.account-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 190px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.account-menu.open .account-dropdown { display: block; }
.account-item {
  display: block; width: 100%; text-align: left; padding: 11px 14px; font-size: 13.5px;
  color: var(--text); background: none; border: none; cursor: pointer; text-decoration: none;
  border-bottom: 1px solid rgba(35,44,61,0.5);
}
.account-item:last-child { border-bottom: none; }
.account-item:hover { background: rgba(247,183,51,0.08); color: var(--accent); }

/* ---------- Upgrade modal ---------- */
.ge-modal { position: fixed; inset: 0; z-index: 80; display: none; }
.ge-modal.open { display: block; }
.ge-modal__overlay { position: absolute; inset: 0; background: rgba(4,6,11,0.66); backdrop-filter: blur(3px); }
.ge-modal__panel {
  position: relative; max-width: 440px; margin: 16vh auto 0; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 18px; padding: 30px; text-align: center;
  box-shadow: var(--shadow);
}
.ge-modal__panel h2 { font-size: 22px; margin: 0 0 10px; }
.ge-modal__panel p { color: var(--text-dim); font-size: 14.5px; line-height: 1.55; margin: 0 0 22px; }
.ge-modal__close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  color: var(--text-dim); font-size: 24px; cursor: pointer; line-height: 1;
}
.ge-modal__close:hover { color: var(--text); }
.ge-modal__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Shutdown overlay ---------- */
.shutdown-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(4,6,11,0.92); backdrop-filter: blur(6px);
  place-items: center;
}
.shutdown-overlay.open { display: grid; }
.shutdown-card { text-align: center; max-width: 380px; padding: 30px; }
.shutdown-icon { font-size: 46px; color: var(--red); margin-bottom: 14px; }
.shutdown-card h2 { font-size: 22px; margin-bottom: 10px; }
.shutdown-card p { font-size: 14px; color: var(--text-dim); line-height: 1.6; }
.shutdown-card code { font-family: var(--mono); color: var(--accent); background: var(--panel); padding: 2px 6px; border-radius: 5px; }

.status-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; color: var(--text-dim);
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint);
}
.status-pill.idle .dot { background: var(--green); }
.status-pill.running .dot { background: var(--accent); animation: pulse 1.1s infinite; }
.status-pill.error .dot { background: var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- Stats row ---------- */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; font-family: var(--mono); }

/* ---------- Filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 11.5px; color: var(--text-dim); font-weight: 500; }
.filter-group.search { flex: 1; min-width: 220px; }
.filters input, .filters select {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 13.5px; width: 110px;
  font-family: inherit;
}
.filter-group.search input { width: 100%; }
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(247,183,51,0.12);
}
.filter-hint {
  font-size: 12px; color: var(--text-dim); margin: -10px 0 14px 4px; line-height: 1.45;
}

.table-pager {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 10px 2px;
}
.table-pager .page-info {
  font-size: 13px; color: var(--text-dim); min-width: 7rem; text-align: center;
}
.page-size-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-dim); margin-left: auto;
}
.page-size-label select {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--text); font-size: 12.5px; font-family: inherit;
}

/* ---------- Table ---------- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-dim); font-weight: 600;
  padding: 14px 16px; background: var(--bg-2); cursor: pointer;
  user-select: none; white-space: nowrap; border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
thead th.num { text-align: right; }
thead th:hover { color: var(--text); }
thead th.sorted-desc::after { content: " ▾"; color: var(--accent); }
thead th.sorted-asc::after { content: " ▴"; color: var(--accent); }

tbody td {
  padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid rgba(35,44,61,0.5);
}
tbody td.num { text-align: right; font-family: var(--mono); }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }
td.empty { text-align: center; color: var(--text-dim); padding: 50px 16px; }

.item-cell { display: flex; align-items: center; gap: 10px; }
.item-cell img { width: 26px; height: 26px; object-fit: contain; }
.item-name { font-weight: 600; }
.tag {
  font-size: 10px; padding: 2px 7px; border-radius: 6px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.tag.mem { background: rgba(90,169,255,0.15); color: var(--blue); }
.tag.f2p { background: rgba(58,210,159,0.15); color: var(--green); }

.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--text-faint); }

.score-badge {
  display: inline-block; min-width: 44px; text-align: center;
  padding: 4px 8px; border-radius: 8px; font-weight: 700; font-family: var(--mono);
}
.score-badge.muted-score { opacity: 0.72; }
.premium-lock {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: rgba(247, 183, 51, 0.1); border: 1px solid rgba(247, 183, 51, 0.22);
  color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; white-space: nowrap;
}
.drawer-strategy-text a { color: var(--accent); }
.qf-bolt { margin-right: 3px; font-family: initial; }
.quick-toggle { display: inline-flex; align-items: center; gap: 6px; }
.quick-toggle.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(247,183,51,0.22), rgba(247,183,51,0.10));
  color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(247,183,51,0.12);
}
.ready-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.4px; vertical-align: middle;
  background: rgba(58,210,159,0.18); color: var(--green);
}

.timing-bar {
  display: inline-flex; align-items: center; gap: 7px; justify-content: flex-end;
}
.timing-track {
  display: inline-block; width: 54px; height: 6px; border-radius: 3px;
  background: var(--border); overflow: hidden; vertical-align: middle;
}
.timing-fill {
  display: block; height: 100%; min-width: 2px; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

/* ---------- Drawer ---------- */
.drawer, .modal { position: fixed; inset: 0; z-index: 50; display: none; }
.drawer.open, .modal.open { display: block; }
.drawer-overlay, .modal-overlay { position: absolute; inset: 0; background: rgba(4,6,11,0.6); backdrop-filter: blur(2px); }
.drawer-panel {
  position: absolute; right: 0; top: 0; height: 100%; width: 560px; max-width: 92vw;
  background: var(--bg-2); border-left: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 26px; overflow-y: auto;
  animation: slideIn 0.22s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-close {
  position: absolute; top: 18px; right: 20px; background: none; border: none;
  color: var(--text-dim); font-size: 26px; cursor: pointer; line-height: 1;
}
.drawer-close:hover { color: var(--text); }
.drawer-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.drawer-head img { width: 44px; height: 44px; object-fit: contain; }
.drawer-head h2 { font-size: 20px; }
.drawer-head p { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

.drawer-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.metric { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; min-width: 0; }
.metric .m-label { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.metric .m-value {
  font-size: 16px; font-weight: 700; font-family: var(--mono); margin-top: 4px;
  line-height: 1.25; overflow-wrap: anywhere; white-space: normal;
}
.metric-sub {
  display: block; font-size: 11px; font-weight: 500; color: var(--text-dim);
  font-family: inherit; margin-top: 2px;
}

.hidden { display: none !important; }

.drawer-strategy {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px;
  border-left: 3px solid var(--accent);
}
.drawer-strategy-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.drawer-strategy-head h3 { font-size: 14px; font-weight: 700; letter-spacing: 0.2px; }
.drawer-strategy-figures {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 10px 0; margin-bottom: 12px;
}
.drawer-strategy-figures > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.drawer-strategy-text {
  font-size: 13px; color: var(--text-dim); line-height: 1.6; margin: 0;
}

.qf-card {
  background: linear-gradient(180deg, rgba(247,183,51,0.10), var(--bg-2));
  border: 1px solid rgba(247,183,51,0.35); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; border-left: 3px solid var(--accent);
}
.qf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.qf-card-title { font-size: 14px; font-weight: 800; color: var(--accent-2); letter-spacing: 0.2px; }
.qf-card-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.4px; padding: 3px 8px; border-radius: 6px; }
.qf-card-badge.ready { background: rgba(58,210,159,0.18); color: var(--green); }
.qf-card-badge.wait { background: rgba(247,183,51,0.18); color: var(--accent); }
.qf-card-figures {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 10px 0; margin-bottom: 10px;
}
.qf-card-figures > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qf-fig-label { font-size: 11px; color: var(--text-dim); }
.qf-fig-value { font-size: 15px; font-weight: 700; font-family: var(--mono); }
.qf-card-plan { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; margin: 0; }

.view-item-btn { width: 100%; margin-bottom: 16px; justify-content: center; }
.view-item-btn:hover { border-color: var(--accent); color: var(--accent-2); }

.chart-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; height: 300px; position: relative; }
.chart-modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; height: min(68vh, 620px); position: relative; }
.chart-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(11,14,20,0.72); color: var(--text-dim); font-size: 13px;
  border-radius: 12px; z-index: 2;
}
.chart-loading.hidden { display: none; }

.chart-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.chart-timeframes { display: flex; gap: 6px; flex-wrap: wrap; }
.tf-btn {
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text-dim);
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.12s ease;
}
.tf-btn:hover { color: var(--text); border-color: #34415a; }
.tf-btn.active {
  background: rgba(247,183,51,0.14); color: var(--accent); border-color: rgba(247,183,51,0.45);
}

.chart-modal {
  position: fixed; inset: 0; z-index: 80; display: none;
}
.chart-modal.open { display: block; }
.chart-modal-overlay {
  position: absolute; inset: 0; background: rgba(4,6,11,0.78); backdrop-filter: blur(3px);
}
.chart-modal-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(1100px, 94vw); max-height: 90vh;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 14px;
}
.chart-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.chart-modal-head h2 { font-size: 20px; }
.chart-modal-head p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.chart-modal-actions { display: flex; align-items: center; gap: 10px; }

.disclaimer { font-size: 11.5px; color: var(--text-faint); margin-top: 16px; line-height: 1.5; }

/* ---------- Modal ---------- */
.modal-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 520px; max-width: 92vw; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.modal-panel h2 { font-size: 19px; }
.modal-sub { font-size: 13px; color: var(--text-dim); margin: 6px 0 18px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.settings-grid input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 13.5px; font-family: var(--mono);
}
.settings-grid input:focus { outline: none; border-color: var(--accent); }
.settings-grid label.settings-check {
  flex-direction: row; align-items: center; gap: 9px; font-size: 13px;
  color: var(--text); align-self: end; padding-bottom: 9px;
}
.settings-grid label.settings-check input { width: 16px; height: 16px; flex: none; }

.settings-account {
  margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.settings-account h3,
.settings-analytics h3 {
  font-size: 12px; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}
.settings-account__meta { font-size: 14px; color: var(--text); margin: 0 0 12px; }
.settings-account__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.settings-account__note { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin: 0; }
.settings-account__note a { color: var(--accent); }
.settings-analytics .modal-sub { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 22px; }

/* ---------- Progress ---------- */
.progress-wrap { margin-top: 4px; }
.progress-track { height: 4px; background: var(--bg-2); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width 0.4s ease; }

/* ---------- Best trades ---------- */
.best-trades { margin-bottom: 22px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-sub { font-size: 12.5px; color: var(--text-dim); }
.best-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.best-empty {
  grid-column: 1 / -1; text-align: center; color: var(--text-dim);
  padding: 28px; background: var(--panel); border: 1px dashed var(--border);
  border-radius: var(--radius); font-size: 13.5px;
}
.best-upsell {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border-style: solid; border-color: rgba(247,183,51,0.3);
}
.best-upsell strong { color: var(--text); font-size: 15px; }
.best-upsell .btn { margin-top: 4px; }
.best-card {
  position: relative; background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 15px 16px; cursor: pointer; transition: all 0.15s ease;
  display: flex; flex-direction: column; gap: 11px; overflow: hidden;
}
.best-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), #e0922b);
}
.best-card:hover { border-color: #34415a; transform: translateY(-2px); box-shadow: var(--shadow); }
.best-rank {
  position: absolute; top: 11px; right: 13px; font-family: var(--mono);
  font-size: 12px; font-weight: 700; color: var(--text-faint);
}
.best-card-head { display: flex; align-items: center; gap: 10px; padding-right: 26px; }
.best-card-head img { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.best-card-title { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.best-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.best-badge {
  align-self: flex-start; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 2px 8px; border-radius: 6px;
}
.badge-fast { background: rgba(58,210,159,0.16); color: var(--green); }
.badge-swing { background: rgba(247,183,51,0.18); color: var(--accent); }
.badge-churn { background: rgba(90,169,255,0.16); color: var(--blue); }
.badge-patient { background: rgba(240,97,109,0.14); color: var(--red); }
.badge-reversion { background: rgba(58,210,159,0.18); color: var(--green); }
.badge-caution { background: rgba(240,97,109,0.14); color: var(--red); }
.badge-steady { background: rgba(138,151,173,0.16); color: var(--text-dim); }
.best-figures {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.best-figures.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.best-figures > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bf-label { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.bf-value { font-size: 14px; font-weight: 700; font-family: var(--mono); overflow-wrap: anywhere; }
.bf-sub { font-size: 11px; font-weight: 500; color: var(--text-dim); font-family: inherit; }
/* Non-numeric values (e.g. Timeline text) read better in the body font. */
.bf-value.bf-text { font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.3; }
.best-strategy { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* ---------- Info icons + tooltips ---------- */
.info {
  display: inline-grid; place-items: center; width: 14px; height: 14px;
  border-radius: 50%; border: 1px solid var(--text-faint); color: var(--text-faint);
  font-size: 9px; font-style: normal; font-weight: 700; cursor: help;
  vertical-align: middle; margin-left: 3px;
}
.info:hover { border-color: var(--accent); color: var(--accent); }
thead th[data-tip] { position: relative; }
thead th[data-tip]:hover { color: var(--accent); }

.tooltip {
  position: fixed; z-index: 100; max-width: 260px; pointer-events: none;
  background: #0a0d14; border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 12px; line-height: 1.5;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease; font-weight: 400;
  text-transform: none; letter-spacing: normal;
}
.tooltip.visible { opacity: 1; transform: none; }

.warn { color: var(--accent); cursor: help; }

/* Game switch (RS3 / OSRS) */
.game-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.game-tab {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: 600 12px/1 "Inter", sans-serif;
  letter-spacing: 0.04em;
  color: var(--muted, #9aa3b2);
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.game-tab:hover { color: #e8ecf3; }
.game-tab.active {
  background: var(--accent, #f7b733);
  color: #1a1300;
}

@media (max-width: 1200px) {
  .best-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .best-grid { grid-template-columns: 1fr 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
}
