:root {
  --bg: #000000;
  --bg-2: #0a0a0c;
  --panel: #15161a;
  --panel-2: #1c1d22;
  --panel-hi: #26272d;
  --border: rgba(255,255,255,0.08);
  --border-hi: rgba(255,255,255,0.16);
  --text: #f5f5f7;
  --muted: #86868b;
  --accent: #0a84ff;
  --accent-2: #30d158;
  --buy: #30d158;
  --sell: #ff453a;
  --hold: #bf5af2;
  --bull: #30d158;
  --bear: #ff453a;
  --neutral: #98989d;
  --warn: #ff9f0a;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 6px 24px rgba(0,0,0,0.35);
  --transition: 180ms cubic-bezier(0.33, 0, 0, 1);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}
button, input, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 20px; }
h2 { font-size: 18px; margin-top: 18px; }
h3 { font-size: 15px; color: var(--accent); }
code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 12, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky; top: 0; z-index: 20;
  gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 22px; color: var(--accent); }
.brand .tag { color: var(--muted); font-size: 12px; display: block; }
.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ctrl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ctrl.inline { gap: 6px; }
.controls input[type=range] { width: 120px; accent-color: var(--accent); }
.controls button {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); padding: 8px 16px;
  border-radius: 10px; cursor: pointer; font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}
.controls button:hover { background: var(--panel-hi); border-color: var(--border-hi); }
.controls button:active { transform: scale(0.97); }
.controls .notify-btn.active {
  background: rgba(78, 163, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.controls .notify-btn.active:hover { background: rgba(78, 163, 255, 0.25); }

.ios-hint {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.ios-hint-inner strong { display: block; margin-bottom: 6px; color: var(--accent); }
.ios-hint-inner p { margin: 0 0 10px 0; font-size: 13px; color: var(--text); line-height: 1.5; }
.ios-hint-inner button {
  background: var(--accent); color: #001a33; border: none;
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.muted { color: var(--muted); font-size: 12px; }

.disclaimer {
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  color: #fcd34d;
  padding: 10px 20px;
  font-size: 13px;
}

.tabs {
  display: flex; gap: 4px; padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  overflow-x: auto;
  position: sticky; top: 62px; z-index: 15;
}
.tab {
  background: transparent; color: var(--muted);
  border: none; padding: 8px 14px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel-hi); }
.tab-content { display: none; padding: 20px; max-width: 1400px; margin: 0 auto; }
.tab-content.active { display: block; }

.status { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card:hover { transform: translateY(-2px); border-color: var(--border-hi); background: var(--panel-2); }
.card:active { transform: translateY(0) scale(0.99); }
.card .card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.card .pair { font-weight: 600; font-size: 17px; letter-spacing: 0.3px; }
.direction-badge {
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  letter-spacing: 1px;
}
.dir-BUY { background: rgba(34,197,94,.15); color: var(--buy); border: 1px solid rgba(34,197,94,.4); }
.dir-SELL { background: rgba(239,68,68,.15); color: var(--sell); border: 1px solid rgba(239,68,68,.4); }
.dir-HOLD { background: rgba(167,139,250,.15); color: var(--hold); border: 1px solid rgba(167,139,250,.4); }

.conf {
  margin: 10px 0 12px;
}
.conf-bar {
  height: 8px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
}
.conf-bar span { display: block; height: 100%; transition: width .4s; }
.conf-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-bottom: 4px;
}
.conf-label b { color: var(--text); font-size: 13px; }

.levels { font-size: 13px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; }
.levels .lbl { color: var(--muted); }
.levels .val { text-align: right; font-family: ui-monospace, monospace; }
.levels .pips { color: var(--muted); font-size: 11px; }

.card .vote-mini {
  display: flex; gap: 4px; margin-top: 10px;
  flex-wrap: wrap;
}
.vote-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vp-bullish { background: rgba(22,163,74,.2); color: #4ade80; }
.vp-bearish { background: rgba(220,38,38,.2); color: #f87171; }
.vp-neutral { background: rgba(100,116,139,.2); color: #94a3b8; }

.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--neutral);
  padding: 12px 14px;
  border-radius: 6px;
}
.news-item.bullish { border-left-color: var(--bull); }
.news-item.bearish { border-left-color: var(--bear); }
.news-item .ni-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11px; color: var(--muted);
  margin-bottom: 4px;
}
.news-item .ni-title {
  font-size: 14px; margin-bottom: 4px; color: var(--text); font-weight: 500;
}
.news-item .ni-summary {
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
}
.sent-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sent-bullish { background: rgba(22,163,74,.2); color: #4ade80; }
.sent-bearish { background: rgba(220,38,38,.2); color: #f87171; }
.sent-neutral { background: rgba(100,116,139,.2); color: #94a3b8; }

.cal-item {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
  display: grid; grid-template-columns: 120px 50px 1fr auto;
  gap: 12px; align-items: center;
  font-size: 13px;
}
.cal-impact-high { border-left: 3px solid var(--sell); }
.cal-impact-medium { border-left: 3px solid var(--warn); }
.cal-impact-low { border-left: 3px solid var(--neutral); }
.cal-country { font-weight: 600; }
.cal-values { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }

.plat {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px 18px;
  margin-bottom: 12px;
  border-radius: 8px;
}
.plat ol { margin: 6px 0 0 20px; padding: 0; }
.plat li { margin-bottom: 4px; }

.calc {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
  max-width: 560px;
  display: grid; gap: 10px;
}
.calc label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.calc input, .calc select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); padding: 8px 10px;
  border-radius: 5px; font-size: 13px;
}
.calc button {
  background: var(--accent); color: #001a33;
  border: none; padding: 8px 14px;
  border-radius: 5px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  justify-self: start;
}
#calc-result {
  font-size: 13px; padding: 10px; background: var(--panel-2);
  border-radius: 5px; display: none;
  font-family: ui-monospace, monospace;
}
#calc-result.visible { display: block; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%; max-width: 700px;
  max-height: 90vh; overflow-y: auto;
  padding: 22px; position: relative;
}
.close-btn {
  position: absolute; top: 10px; right: 12px;
  background: transparent; color: var(--muted);
  border: none; font-size: 26px; cursor: pointer;
}
.close-btn:hover { color: var(--text); }

.modal-body h2 { display: flex; align-items: center; gap: 10px; }
.modal-body .dir-price { font-family: ui-monospace, monospace; color: var(--accent); }

.votes-table {
  width: 100%; border-collapse: collapse;
  margin: 10px 0; font-size: 13px;
}
.votes-table th, .votes-table td {
  text-align: left; padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
.votes-table th { color: var(--muted); font-weight: 500; font-size: 12px; }

.plan-steps { background: var(--panel-2); padding: 12px 16px; border-radius: 6px; }
.plan-steps ol { margin: 0 0 0 20px; }
.plan-steps li { margin-bottom: 4px; font-size: 13px; }

.perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.perf-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 8px;
  text-align: center;
}
.perf-card .big {
  font-size: 28px; font-weight: 700; color: var(--accent);
}
.perf-card .lbl {
  color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer {
  padding: 16px 20px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .controls { justify-content: space-between; }
  .cal-item { grid-template-columns: 1fr; gap: 4px; }
}

/* ============ Apple-style polish for new sections ============ */

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.modal-actions {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}
.take-trade-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}
.take-trade-btn:hover:not(:disabled) { background: #1a95ff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(10,132,255,0.3); }
.take-trade-btn:disabled { background: var(--panel-2); color: var(--muted); cursor: not-allowed; }

/* Trades tab */
.trade-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: all var(--transition);
}
.trade-row:hover { border-color: var(--border-hi); }
.trade-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.trade-head .pair { font-weight: 600; font-size: 15px; }
.trade-head .trade-status { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; }
.trade-levels { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; font-family: ui-monospace, monospace; }
.trade-levels code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; color: var(--text); }
.trade-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.trade-actions button {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); padding: 5px 11px;
  border-radius: 8px; cursor: pointer; font-size: 12px;
  transition: all var(--transition);
}
.trade-actions button:hover { background: var(--panel-hi); border-color: var(--border-hi); }
.trade-delete:hover { background: rgba(255,69,58,0.15) !important; color: var(--sell) !important; border-color: rgba(255,69,58,0.4) !important; }

/* Forex Wisdom tab */
.wisdom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.wisdom-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all var(--transition);
}
.wisdom-card:hover { border-color: var(--border-hi); }
.wisdom-card h3 { color: var(--text); font-size: 15px; margin-bottom: 10px; }
.wisdom-card ul { margin: 0; padding-left: 20px; font-size: 13px; }
.wisdom-card li { margin-bottom: 6px; color: var(--text); }
.wisdom-card strong { color: var(--accent); }

/* Refined buttons */
#refresh-btn, #auto-refresh { transition: all var(--transition); }

/* Smoother news items */
.news-item { border-radius: var(--radius); transition: all var(--transition); }
.news-item:hover { border-color: var(--border-hi); }

/* Perf cards richer */
.perf-card { border-radius: var(--radius); transition: all var(--transition); }
.perf-card:hover { border-color: var(--border-hi); }

/* Calendar items */
.cal-item { border-radius: var(--radius); transition: all var(--transition); }
.cal-item:hover { border-color: var(--border-hi); }

/* Plat cards */
.plat { border-radius: var(--radius); }

/* Smoother modal close */
.close-btn { transition: all var(--transition); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.close-btn:hover { background: var(--panel-2); color: var(--text); }

/* Calc inputs */
.calc { border-radius: var(--radius); }
.calc input, .calc select {
  border-radius: 8px;
  transition: all var(--transition);
}
.calc input:focus, .calc select:focus { outline: none; border-color: var(--accent); background: var(--panel-hi); }
.calc button { border-radius: 10px; transition: all var(--transition); }
.calc button:hover { background: #1a95ff; transform: translateY(-1px); }

/* Smooth header transitions */
.topbar, .tabs { transition: background var(--transition); }

/* Modal content padding upgrade */
.modal-content { padding: 26px 28px; }


.cal-warning {
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid rgba(255, 159, 10, 0.35);
  color: var(--warn);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
}

.strategy-list { display: grid; gap: 8px; margin-bottom: 14px; }
.strategy-item {
  display: grid;
  grid-template-columns: 180px 80px 1fr;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  align-items: center;
  transition: all var(--transition);
}
.strategy-item:hover { border-color: var(--border-hi); }
.strategy-item.strategy-bullish { border-left: 3px solid var(--buy); }
.strategy-item.strategy-bearish { border-left: 3px solid var(--sell); }
.strategy-name { font-weight: 600; }
.strategy-bias {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 5px;
  text-align: center;
}
.bias-bullish { background: rgba(48,209,88,0.15); color: var(--buy); }
.bias-bearish { background: rgba(255,69,58,0.15); color: var(--sell); }
.strategy-reason { color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .strategy-item { grid-template-columns: 1fr auto; }
  .strategy-reason { grid-column: 1 / -1; }
}

/* ============ Best-Setup visual treatment ============ */
.best-btn { border-radius: 10px; transition: all var(--transition); }
.best-btn.active {
  background: linear-gradient(135deg, #ffd60a, #ff9500);
  color: #000;
  border-color: #ffd60a;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(255,159,10,0.35);
}
.best-btn.active:hover { filter: brightness(1.1); }

.card-best {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, #ffd60a, #ff9500, #ff453a) border-box;
  box-shadow: 0 0 20px rgba(255,159,10,0.15), var(--shadow);
}
.card-best:hover {
  box-shadow: 0 0 30px rgba(255,159,10,0.25), var(--shadow);
  transform: translateY(-3px);
}
.best-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: linear-gradient(135deg, #ffd60a, #ff9500);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 5px;
  z-index: 2;
}
