.map-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.map-row .arrow { color: var(--muted); }
:root {
	--bg: #ffffff;
	--surface: #ffffff;
	--glass: #ffffff;
	--text: #151922;
	--muted: #6b7280;
	--primary: #e8431f;
	--primary-700: #c4381a;
	--border: #e5e7eb;
	--shadow: 0 6px 18px rgba(0,0,0,0.06);
	--topbar-h: 56px;
	--table-header-bg: #f9fafb;
	--input-bg: #ffffff;
	--code-bg: #f8f9fa;
	--code-text: #1f2937;
	--danger-text: #dc2626;
	--danger-bg: #fef2f2;
	--danger-border: #fecaca;
	--success: #22c55e;
	--primary-bg-subtle: rgba(232, 67, 31, 0.08);
	--gain-bg: rgba(34, 197, 94, 0.08);
	--loss-bg: rgba(239, 68, 68, 0.08);
	--pos-long: #0a7d33;
	--pos-short: #a31212;
}

/* Dark theme variables - support both html and body for smooth loading */
html.dark-theme,
body.dark-theme {
	--bg: #0f1419;
	--surface: #1a1f2e;
	--glass: #1a1f2e;
	--text: #e4e6eb;
	--muted: #9ca3af;
	--primary: #ff6b47;
	--primary-700: #ff5533;
	--border: #2d3748;
	--shadow: 0 6px 18px rgba(0,0,0,0.4);
	--table-header-bg: #252b3b;
	--input-bg: #252b3b;
	--code-bg: #0a0f14;
	--code-text: #d7e1ea;
	--danger-text: #fca5a5;
	--danger-bg: rgba(239, 68, 68, 0.2);
	--danger-border: rgba(239, 68, 68, 0.35);
	--success: #22c55e;
	--primary-bg-subtle: rgba(255, 107, 71, 0.15);
	--gain-bg: rgba(34, 197, 94, 0.12);
	--loss-bg: rgba(239, 68, 68, 0.12);
	--pos-long: #4ade80;
	--pos-short: #f87171;
}

html.dark-theme,
body.dark-theme {
	background: var(--bg);
	color: var(--text);
}

/* Dark theme adjustments */
body.dark-theme .glass {
	background: var(--glass);
	border-color: var(--border);
}

body.dark-theme .btn {
	background: var(--surface);
	color: var(--text);
	border-color: var(--border);
}

body.dark-theme .btn:hover {
	background: #252b3b;
	border-color: #3d4a5e;
}

body.dark-theme .btn.primary {
	background: var(--surface);
	color: var(--primary);
	border-color: var(--primary);
}

body.dark-theme .btn.primary:hover {
	background: rgba(255,107,71,0.1);
}

body.dark-theme .btn.ghost {
	background: var(--surface);
}

body.dark-theme .btn.blue {
	background: var(--surface);
}

body.dark-theme .btn.blue:hover {
	background: rgba(21,88,214,0.15);
}

body.dark-theme .btn.orange {
	background: var(--surface);
}

body.dark-theme .btn.orange:hover {
	background: rgba(255,122,0,0.15);
}

body.dark-theme .side-link {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .side-link:hover {
	background: #252b3b;
}

body.dark-theme .side-link.active {
	background: rgba(255,107,71,0.15);
	border-color: var(--primary);
}

body.dark-theme .nav-expand-toggle .expand-arrow {
	color: var(--muted);
}

body.dark-theme .nav-sub-item:hover {
	border-left-color: var(--primary);
}

body.dark-theme .content {
	background: var(--bg);
}

body.dark-theme .card {
	background: var(--surface);
}

body.dark-theme .table {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .table th {
	background: #252b3b;
	color: var(--muted);
}

body.dark-theme .table td {
	border-color: var(--border);
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
	background: #252b3b !important;
	color: var(--text) !important;
	border-color: var(--border) !important;
}

body.dark-theme input:focus,
body.dark-theme select:focus,
body.dark-theme textarea:focus {
	border-color: var(--primary) !important;
	box-shadow: 0 0 0 3px rgba(255,107,71,0.18) !important;
}

body.dark-theme .modal {
	background: rgba(0,0,0,0.7);
}

body.dark-theme .modal .dialog {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .modal .dialog .head,
body.dark-theme .modal .dialog .footer {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .badge {
	background: #252b3b;
	border-color: var(--border);
}

body.dark-theme .pill {
	background: #252b3b;
	border-color: var(--border);
}

body.dark-theme .stat-icon {
	background: rgba(255,107,71,0.15);
	border-color: rgba(255,107,71,0.3);
}

body.dark-theme .icon-btn {
	background: var(--surface);
	border-color: var(--border);
	color: var(--muted);
}

body.dark-theme .icon-btn:hover {
	background: #252b3b;
	color: var(--primary);
	border-color: var(--primary);
}

body.dark-theme .lang-selector {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .lang-selector:hover {
	background: #252b3b;
}

body.dark-theme .lang-dropdown {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .lang-dropdown .opt:hover {
	background: #252b3b;
}

body.dark-theme .lang-dropdown .opt.active {
	background: rgba(255,107,71,0.15);
}

body.dark-theme .vendor-card {
	background: var(--surface);
}

body.dark-theme .faq-cat,
body.dark-theme .faq-result,
body.dark-theme .faq-detail {
	background: var(--surface);
}

body.dark-theme .faq-results {
	background: #252b3b;
}

body.dark-theme .changelog-entry {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .changelog-entry .item {
	background: #252b3b;
	border-color: var(--border);
}

body.dark-theme .auth-body {
	background:
		linear-gradient(180deg, rgba(15,20,25,0.9), rgba(26,31,46,0.9)),
		radial-gradient(1200px 600px at -10% -10%, rgba(255,107,71,0.1), transparent 40%),
		radial-gradient(900px 500px at 110% 10%, rgba(255,152,0,0.08), transparent 40%),
		radial-gradient(800px 500px at 50% 120%, rgba(108,99,255,0.08), transparent 40%);
}

body.dark-theme .mobile-topbar {
	background: var(--glass);
	border-color: var(--border);
}

body.dark-theme .backdrop {
	background: rgba(0,0,0,0.6);
}

body.dark-theme .tutorial-backdrop {
	background: rgba(0,0,0,0.7);
}

body.dark-theme .tutorial-modal {
	background: var(--surface);
	color: var(--text);
	border-color: var(--border);
}

body.dark-theme .tutorial-tooltip {
	background: var(--surface);
	color: var(--text);
	border-color: var(--border);
}

body.dark-theme .cal-controls .group {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .cal-controls .chip {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .error {
	background: rgba(255, 107, 107, 0.15);
	border-color: rgba(255, 107, 107, 0.35);
}

body.dark-theme .toast .item {
	background: var(--surface);
	border-color: var(--border);
}

/* Dark mode for specific table row highlights - now handled by CSS variables */

/* Dark mode for FAQ sections */
body.dark-theme .faq-cat-icon,
body.dark-theme .faq-result-icon {
	background: #1f2937;
	border-color: var(--border);
}

body.dark-theme .faq-search-field {
	background: var(--glass);
	border-color: var(--border);
}

body.dark-theme .faq-search-field input {
	color: var(--text);
}

body.dark-theme .faq-header {
	background: var(--glass);
	border-color: var(--border);
}

/* Dark mode for FAQ article tables */
body.dark-theme .faq-detail-body table,
body.dark-theme .faq-modal table {
	border-color: #4b5563;
}

body.dark-theme .faq-detail-body table td,
body.dark-theme .faq-detail-body table th,
body.dark-theme .faq-modal table td,
body.dark-theme .faq-modal table th {
	border-color: #4b5563;
}

body.dark-theme .faq-detail-body hr,
body.dark-theme .faq-modal hr {
	border-color: #4b5563;
}

body.dark-theme .faq-modal .faq-modal-cat {
	color: #ffa726;
}

body.dark-theme .faq-stage {
	background: var(--glass);
	border-color: var(--border);
}

/* Dark mode for vendor cards */
body.dark-theme .vendor-card-note {
	background: rgba(239, 68, 68, 0.2);
	color: #fca5a5;
}

body.dark-theme .vendor-detail-note {
	background: #1f2937;
	color: #9ca3af;
	border: 1px solid var(--border);
}

/* Dark mode for download cards */
body.dark-theme .dl {
	background: var(--surface);
}

/* Dark mode for affiliate referral row highlights - override inline styles */
body.dark-theme #ref-tbody tr[style*="background: #e9f9ef"],
body.dark-theme #ref-tbody tr[style*="background:#e9f9ef"] {
	background: rgba(34, 197, 94, 0.15) !important;
}

body.dark-theme #ref-tbody tr[style*="background: #fff7e6"],
body.dark-theme #ref-tbody tr[style*="background:#fff7e6"] {
	background: rgba(245, 158, 11, 0.15) !important;
}

body.dark-theme #ref-tbody tr[style*="background: #ffe8e8"],
body.dark-theme #ref-tbody tr[style*="background:#ffe8e8"] {
	background: rgba(239, 68, 68, 0.15) !important;
}

/* Dark mode for comboboxes (leader/follower account dropdowns) */
body.dark-theme .combo-selected {
	background: var(--surface) !important;
	border-color: var(--border) !important;
	color: var(--text) !important;
}

body.dark-theme .combo-menu {
	background: var(--surface) !important;
	border-color: var(--border) !important;
}

body.dark-theme .combo-menu .combo-item {
	color: var(--text) !important;
}

body.dark-theme .combo-menu .combo-item:hover {
	background: #252b3b !important;
}

body.dark-theme .combo-item .muted {
	color: var(--muted) !important;
}

/* Dark mode for positions tabs container */
body.dark-theme #pos-tabs > div[style*="background:#f9fafb"],
body.dark-theme #pos-tabs > div[style*="background: #f9fafb"] {
	background: var(--surface) !important;
	border-color: var(--border) !important;
}

/* Positions button and label styles now handled by CSS variables */
body.dark-theme #section-positions .compact-label {
	background: var(--surface);
	border-color: var(--primary);
	color: var(--text);
}

/* Dark mode for economic calendar controls */
body.dark-theme .cal-controls .group {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme .cal-controls .chip {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme #calendar-table {
	background: var(--surface);
	border-color: var(--border);
}

body.dark-theme #calendar-table table {
	background: var(--surface);
}

body.dark-theme #calendar-table thead th {
	background: #252b3b;
	color: var(--muted);
	border-color: var(--border);
}

body.dark-theme #calendar-table tbody td,
body.dark-theme #calendar-table tbody th {
	border-color: var(--border);
	color: var(--text);
}

body.dark-theme #calendar-table .date-row td {
	background: rgba(255,107,71,0.15);
	color: var(--primary);
}

/* Dark mode for vendor search input */
body.dark-theme .vendor-search-input {
	background: var(--surface);
	border-color: var(--border);
	color: var(--text);
}

/* Dark mode for sync button in edit account mapping */
body.dark-theme #btn-sync-accounts {
	background: var(--surface) !important;
	border-color: var(--border) !important;
	color: var(--muted) !important;
}

body.dark-theme #btn-sync-accounts:hover {
	background: #252b3b !important;
	color: var(--primary) !important;
	border-color: var(--primary) !important;
}

/* Dark mode: Cancellation Banner */
body.dark-theme .sub-cancel-banner {
	background: linear-gradient(135deg, rgba(30, 20, 15, 0.92) 0%, rgba(35, 22, 16, 0.88) 50%, rgba(40, 25, 18, 0.95) 100%);
	border-color: rgba(194, 65, 12, 0.3);
	box-shadow: 0 18px 50px rgba(234, 88, 12, 0.18);
	color: #fbbf77;
}

body.dark-theme .sub-cancel-banner:hover {
	box-shadow: 0 20px 60px rgba(234, 88, 12, 0.25);
}

body.dark-theme .sub-cancel-banner .scb-decoration {
	background: radial-gradient(circle at 30% 30%, rgba(249, 115, 22, 0.12), transparent 60%), radial-gradient(circle at 70% 60%, rgba(234, 88, 12, 0.10), transparent 70%);
	opacity: 0.7;
}

body.dark-theme .sub-cancel-banner .scb-pill {
	background: rgba(30, 20, 15, 0.8);
	border-color: rgba(249, 115, 22, 0.4);
	color: #fb923c;
	backdrop-filter: blur(10px);
}

body.dark-theme .sub-cancel-banner .scb-end-text {
	color: #fdba74;
}

body.dark-theme .sub-cancel-banner .scb-message h4 {
	color: #fed7aa;
}

body.dark-theme .sub-cancel-banner .scb-message p {
	color: #fdba74;
}

body.dark-theme .sub-cancel-banner .scb-reason {
	background: rgba(30, 20, 15, 0.7);
	border-color: rgba(249, 115, 22, 0.4);
	color: #fcd34d;
}

body.dark-theme .sub-cancel-banner .scb-reason i {
	color: #fb923c;
}

body.dark-theme .sub-cancel-banner .scb-countdown {
	background: rgba(30, 20, 15, 0.6);
	border-color: rgba(249, 115, 22, 0.3);
	box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.15);
}

body.dark-theme .sub-cancel-banner .scb-unit {
	background: rgba(40, 25, 18, 0.85);
	border-color: rgba(249, 115, 22, 0.35);
}

body.dark-theme .sub-cancel-banner .scb-unit::after {
	background: linear-gradient(180deg, rgba(60, 35, 25, 0.4) 0%, rgba(60, 35, 25, 0) 100%);
	opacity: 0.6;
}

body.dark-theme .sub-cancel-banner .scb-value {
	color: #fb923c;
	text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

body.dark-theme .sub-cancel-banner .scb-label {
	color: #fdba74;
}

body.dark-theme .sub-cancel-banner .scb-countdown-caption {
	color: #fed7aa;
	background: rgba(30, 20, 15, 0.7);
	border-color: rgba(249, 115, 22, 0.3);
}

body.dark-theme .sub-cancel-banner .scb-progress {
	background: rgba(249, 115, 22, 0.15);
}

body.dark-theme .sub-cancel-banner .scb-progress-fill {
	background: linear-gradient(90deg, rgba(249, 115, 22, 0.9), rgba(234, 88, 12, 1));
}

body.dark-theme .sub-cancel-banner .scb-btn.ghost {
	background: rgba(30, 20, 15, 0.7);
	border-color: rgba(249, 115, 22, 0.4);
	color: #fb923c;
}

body.dark-theme .sub-cancel-banner .scb-btn.ghost:hover {
	background: rgba(40, 25, 18, 0.85);
	border-color: rgba(249, 115, 22, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); transition: background-color 200ms ease, color 200ms ease; }

/* Smooth transitions for theme toggle */
.glass, .btn, .card, .table, .sidebar, .content, .side-link, .lang-selector, .theme-toggle, .icon-btn, .modal .dialog, .sub-cancel-banner, .sub-cancel-banner .scb-pill, .sub-cancel-banner .scb-end-text, .sub-cancel-banner .scb-message h4, .sub-cancel-banner .scb-message p, .sub-cancel-banner .scb-reason, .sub-cancel-banner .scb-countdown, .sub-cancel-banner .scb-unit, .sub-cancel-banner .scb-value, .sub-cancel-banner .scb-label, .sub-cancel-banner .scb-countdown-caption, .sub-cancel-banner .scb-progress, .sub-cancel-banner .scb-btn {
	transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

input, select, textarea {
	transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.glass { background: #ffffff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); color: var(--text); background: #ffffff; padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: 160ms ease-in-out; }
.btn:hover { border-color: #d1d5db; background: #f9fafb; transform: translateY(-1px); }
.btn.primary { background: #ffffff; color: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: #fff6f3; }
.btn.ghost { background: #ffffff; color: var(--text); }
/* Blue and Orange variants to mirror desktop Save behavior */
.btn.blue { color: #1558d6; border-color: #1558d6; background: #ffffff; }
.btn.blue:hover { background: #eef3ff; border-color: #0f47ae; }
.btn.orange { color: #ff7a00; border-color: #ff7a00; background: #ffffff; }
.btn.orange:hover { background: #fff4e8; border-color: #e56e00; }

/* Save button badges and pulse effect */
.btn .btn-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; font-size: 12px; font-weight: 700; border-radius: 999px; margin-left: 6px; border: 1px solid currentColor; color: currentColor; background: #fff; }
.btn.attention { position: relative; }
.btn.attention::after { content: ""; position: absolute; inset: -2px; border-radius: 12px; box-shadow: 0 0 0 0 rgba(232,67,31,0.18); animation: pulse-soft 1600ms ease-out infinite; pointer-events: none; }
@keyframes pulse-soft { 0% { box-shadow: 0 0 0 0 rgba(232,67,31,0.18); } 70% { box-shadow: 0 0 0 10px rgba(232,67,31,0); } 100% { box-shadow: 0 0 0 0 rgba(232,67,31,0); } }

.muted { color: var(--muted); }

/* Auth */
.auth-body { display: grid; place-items: center; min-height: 100vh; background:
		linear-gradient(180deg, rgba(248,249,251,0.9), rgba(255,255,255,0.9)),
		radial-gradient(1200px 600px at -10% -10%, rgba(232,67,31,0.06), transparent 40%),
		radial-gradient(900px 500px at 110% 10%, rgba(255,152,0,0.06), transparent 40%),
		radial-gradient(800px 500px at 50% 120%, rgba(108,99,255,0.05), transparent 40%);
}
.auth-container { width: 100%; max-width: 420px; padding: 24px; }
.auth-card { padding: 28px; }
.auth-layout { width: 100%; max-width: 1000px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 24px; }
.auth-panel { padding: 28px; }
.auth-side { padding: 28px; position: relative; overflow: hidden; }
.auth-side::before { content: ""; position: absolute; inset: 0; background-image:
		repeating-linear-gradient(0deg, rgba(21,25,34,0.03) 0, rgba(21,25,34,0.03) 1px, transparent 1px, transparent 24px),
		repeating-linear-gradient(90deg, rgba(21,25,34,0.03) 0, rgba(21,25,34,0.03) 1px, transparent 1px, transparent 24px);
	pointer-events: none; }
.auth-head { text-align: center; margin-bottom: 16px; }
.auth-logo { width: 56px; height: 56px; object-fit: contain; }
.field { display: grid; gap: 6px; }
.auth-illustration { margin-top: 8px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); background: #ffffff; }
.auth-illustration img { display: block; width: 100%; height: auto; }
.side-content { display: grid; align-content: start; gap: 10px; height: 100%; }
.side-title { margin: 0; font-size: 20px; }
.side-text { font-size: 14px; }
.auth-submit { position: relative; justify-content: center; }
.auth-submit .btn-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; display: none; }
.auth-submit.loading .btn-label { opacity: 0.6; }
.auth-submit.loading .btn-spinner { display: inline-block; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* helper for rotating font-awesome icons */
.spin { animation: spin 800ms linear infinite; }

@media (max-width: 900px) {
	.auth-layout { grid-template-columns: 1fr; max-width: 540px; }
	.auth-side { order: -1; }
}
.brand { text-align: center; margin-bottom: 16px; }
.brand img { width: 56px; height: 56px; object-fit: contain; }
.brand h1 { margin: 12px 0 6px; font-size: 24px; }
.form { display: grid; gap: 10px; }
.form label { font-weight: 600; font-size: 13px; color: var(--muted); }
.form input { background: #ffffff; border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 12px 14px; outline: none; transition: 120ms; }
.form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,67,31,0.18); }
.summary input, .summary select, .summary textarea { background: #ffffff; border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 10px 12px; outline: none; transition: 120ms; }
.summary input:focus, .summary select:focus, .summary textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,67,31,0.18); }
.form .hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.error { color: #ff6b6b; background: rgba(255, 107, 107, 0.08); border: 1px solid rgba(255, 107, 107, 0.25); padding: 10px 12px; border-radius: 10px; }

/* Dashboard */
.dashboard { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { padding: 16px; display: grid; grid-template-rows: auto 1fr auto; gap: 14px; }
.sidebar-header { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }
.sidebar-header img { width: 36px; height: 36px; }
.sidebar-header .user { display: flex; align-items: center; gap: 6px; min-width: 0; width: 100%; }
.header-controls { display: flex; align-items: center; gap: 6px; }
.flag-icon { width: 8px; height: 6px; object-fit: cover; border: 1px solid var(--border); border-radius: 2px; background: #fff; }
.sidebar .user-name { font-size: 14px; color: var(--text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
/* Theme toggle button */
.theme-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: #ffffff; cursor: pointer; transition: all 160ms ease; }
.theme-toggle:hover { background: #f9fafb; border-color: var(--primary); }
.theme-toggle i { font-size: 12px; transition: all 200ms ease; position: absolute; }
.theme-toggle .theme-icon-dark { opacity: 1; color: #6b7280; }
.theme-toggle .theme-icon-light { opacity: 0; color: #f59e0b; }
body.dark-theme .theme-toggle { background: var(--surface); }
body.dark-theme .theme-toggle:hover { background: #252b3b; }
body.dark-theme .theme-toggle .theme-icon-dark { opacity: 0; }
body.dark-theme .theme-toggle .theme-icon-light { opacity: 1; }
/* Language selector (flag to right of name, with code) */
.lang-selector { position: relative; display: inline-flex; align-items: center; gap: 3px; padding: 0 4px; border: 1px solid var(--border); border-radius: 6px; background: #ffffff; cursor: pointer; flex: 1; }
.lang-selector:hover { background: #f9fafb; }
.lang-code { font-size: 10px; color: var(--muted); font-weight: 700; }
.lang-dropdown { position: absolute; top: 100%; left: 0; z-index: 20; margin-top: 6px; border: 1px solid var(--border); background: #ffffff; border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.lang-dropdown .opt { display: flex; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer; }
.lang-dropdown .opt:hover { background: #f9fafb; }
.lang-dropdown .opt.active { background: #fff6f3; color: var(--primary); }
.lang-dropdown .flag { width: 14px; height: 10px; object-fit: cover; border: 1px solid var(--border); border-radius: 2px; background: #fff; }
.hidden { display: none !important; }
.side-nav { display: grid; align-content: start; gap: 6px; overflow-y: auto; overflow-x: hidden; }
/* Custom scrollbar for side-nav */
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }
.side-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.side-nav::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.side-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.side-link { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; border: 1px solid var(--border); background: #ffffff; color: var(--text); padding: 10px 12px; border-radius: 10px; text-align: left; cursor: pointer; transition: 160ms; }
.side-link:hover { background: #f9fafb; }
.side-link.active { border-color: var(--primary); color: var(--primary); background: #fff6f3; }
.side-link .icon { color: inherit; }
.side-link > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-link .nav-badge span { overflow: visible; text-overflow: clip; }

/* Badge for exclusive features with marquee animation */
.side-link:has(.nav-badge) { 
	grid-template-columns: 20px 1fr auto; 
}
.nav-badge { 
	display: inline-flex; 
	align-items: center;
	font-size: 8px; 
	font-weight: 700; 
	padding: 3px 6px; 
	border-radius: 4px; 
	background: linear-gradient(135deg, #eab308 0%, #f59e0b 100%); 
	color: #fff; 
	text-transform: uppercase; 
	letter-spacing: 0.04em; 
	box-shadow: 0 2px 4px rgba(234, 179, 8, 0.2);
	margin-left: 8px;
	overflow: hidden;
	width: 65px;
	position: relative;
	flex-shrink: 0;
}
.nav-badge span {
	display: inline-block;
	white-space: nowrap;
	animation: marquee 12s linear infinite;
}
@keyframes marquee {
	0%, 10% {
		transform: translateX(100%);
	}
	90%, 100% {
		transform: translateX(-100%);
	}
}
/* Pause animation on hover */
.side-link:hover .nav-badge span {
	animation-play-state: paused;
}

/* Expandable navigation menu */
.nav-expandable { display: grid; gap: 6px; }
.nav-expand-toggle { position: relative; display: grid; grid-template-columns: 20px 1fr 16px; }
.nav-expand-toggle .expand-arrow { font-size: 12px; color: var(--muted); transition: transform 200ms ease; justify-self: end; }
.nav-expand-toggle.expanded .expand-arrow { transform: rotate(180deg); }
.nav-expand-content { display: grid; gap: 4px; max-height: 0; overflow: hidden; transition: max-height 300ms ease, opacity 200ms ease; opacity: 0; padding-left: 0; }
.nav-expand-content.expanded { max-height: 300px; opacity: 1; }
.nav-sub-item { padding-left: 24px !important; font-size: 13px; border-left: 2px solid transparent; }
.nav-sub-item:has(.nav-badge) { grid-template-columns: 20px 1fr auto; }
.nav-sub-item:hover { border-left-color: var(--primary); }
.nav-sub-item.active { border-left-color: var(--primary); }

.side-sep { height: 1px; background: var(--border); margin: 6px 0; }
.side-bottom { display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.side-bottom .btn { justify-content: center; width: 100%; }
.side-bottom .btn.space { margin-top: 4px; }

.changelog-list { display: grid; gap: 16px; }
.changelog-entry { background: #ffffff; border-radius: 12px; padding: 18px; border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); }
.changelog-entry .header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.changelog-entry .title { font-size: 20px; font-weight: 700; color: var(--text); }
.changelog-entry .date { font-size: 14px; color: var(--muted); }
.changelog-entry .items { display: grid; gap: 10px; }
.changelog-entry .item { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 10px; background: #f9fafb; border: 1px solid var(--border); }
.changelog-entry .item .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(232,67,31,0.08); color: var(--primary); border: 1px solid rgba(232,67,31,0.18); white-space: nowrap; }
.changelog-entry .item .desc { font-size: 14px; color: var(--text); line-height: 1.5; }

.changelog-entry .item.type-new .tag { background: rgba(34,197,94,0.12); color: #14804a; border-color: rgba(34,197,94,0.28); }
.changelog-entry .item.type-improved .tag { background: rgba(59,130,246,0.14); color: #1d4ed8; border-color: rgba(59,130,246,0.26); }
.changelog-entry .item.type-fixed .tag { background: rgba(248,113,113,0.14); color: #b91c1c; border-color: rgba(248,113,113,0.28); }
.changelog-entry .item.type-note .tag { background: rgba(14,165,233,0.14); color: #0369a1; border-color: rgba(14,165,233,0.24); }

.changelog-entry .badge { background: rgba(15,23,42,0.6); border-color: rgba(148,163,184,0.25); color: #e2e8f0; }

.content { padding: 28px; background: #ffffff; }
.panel { display: none; animation: fade 220ms ease-in; }
.panel.active { display: block; }
@keyframes fade { from{ opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { padding: 18px; background: #ffffff; }
.card h3 { margin: 0 0 12px; }
.kvs { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(140px, 1fr)); }
.kvs div { display: grid; gap: 4px; }
.kvs span { color: var(--muted); font-size: 12px; }
.kvs strong { font-size: 15px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sub-cancel-banner { position: relative; overflow: hidden; margin: 16px 0 12px; border-radius: 18px; padding: 20px 22px; background: linear-gradient(135deg, rgba(255,241,235,0.92) 0%, rgba(255,247,237,0.88) 50%, rgba(255,255,255,0.95) 100%); border: 1px solid rgba(255, 186, 150, 0.6); box-shadow: 0 18px 50px rgba(244,114,41,0.16); color: #91270b; transition: transform 160ms ease, box-shadow 160ms ease; }
.sub-cancel-banner:hover { transform: translateY(-2px); box-shadow: 0 20px 60px rgba(244,114,41,0.22); }
.sub-cancel-banner.hidden { display: none !important; }
.sub-cancel-banner .scb-inner { display: grid; gap: 16px; position: relative; z-index: 1; }
.sub-cancel-banner .scb-decoration { position: absolute; inset: -40px -60px auto auto; width: 220px; height: 180px; background: radial-gradient(circle at 30% 30%, rgba(255,96,0,0.18), transparent 60%), radial-gradient(circle at 70% 60%, rgba(255,171,0,0.16), transparent 70%); z-index: 0; opacity: 0.85; pointer-events: none; }
.sub-cancel-banner .scb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sub-cancel-banner .scb-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.65); border: 1px solid rgba(255, 190, 160, 0.8); color: #c2410c; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; backdrop-filter: blur(10px); }
.sub-cancel-banner .scb-pill i { font-size: 12px; }
.sub-cancel-banner .scb-end-text { font-size: 13px; color: #8a3410; font-weight: 600; }
.sub-cancel-banner .scb-body { display: grid; gap: 18px; grid-template-columns: minmax(240px, 1fr) minmax(260px, 1fr); align-items: stretch; }
.sub-cancel-banner .scb-message h4 { margin: 0 0 6px; font-size: 20px; font-weight: 800; color: #7c2d12; letter-spacing: -0.01em; }
.sub-cancel-banner .scb-message p { margin: 0; font-size: 13px; color: #8a3410; line-height: 1.6; }
.sub-cancel-banner .scb-message p + p { margin-top: 8px; }
.sub-cancel-banner .scb-reason { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,0.6); border: 1px dashed rgba(249,115,22,0.5); color: #92400e; font-size: 12px; }
.sub-cancel-banner .scb-reason i { color: #fb923c; }
.sub-cancel-banner .scb-timer { display: grid; gap: 12px; align-content: center; justify-items: stretch; position: relative; }
.sub-cancel-banner .scb-countdown { display: grid; grid-template-columns: repeat(4, minmax(70px, 1fr)); gap: 10px; background: rgba(255,255,255,0.7); padding: 12px; border-radius: 16px; border: 1px solid rgba(255, 213, 186, 0.8); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); backdrop-filter: blur(12px); }
.sub-cancel-banner .scb-unit { display: grid; gap: 6px; justify-items: center; padding: 10px 6px; border-radius: 12px; background: rgba(255,250,245,0.9); border: 1px solid rgba(255, 193, 149, 0.54); position: relative; overflow: hidden; }
.sub-cancel-banner .scb-unit::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 100%); opacity: 0.8; pointer-events: none; }
.sub-cancel-banner .scb-value { font-size: 26px; font-weight: 800; letter-spacing: 0.04em; color: #b45309; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }
.sub-cancel-banner .scb-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #9a3412; }
.sub-cancel-banner .scb-countdown-caption { font-size: 12px; font-weight: 600; color: #9a3412; text-align: center; padding: 4px 8px; border-radius: 10px; background: rgba(255,242,235,0.8); border: 1px solid rgba(255,210,186,0.6); }
.sub-cancel-banner .scb-progress { position: relative; height: 4px; width: 100%; border-radius: 999px; background: rgba(249,115,22,0.18); overflow: hidden; }
.sub-cancel-banner .scb-progress-fill { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(249,115,22,0.85), rgba(234,88,12,0.95)); transform-origin: left center; transform: scaleX(0); transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1); }
.sub-cancel-banner .scb-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.sub-cancel-banner .scb-btn { font-weight: 700; border-radius: 999px; padding: 10px 18px; box-shadow: 0 12px 24px rgba(234,88,12,0.12); }
.sub-cancel-banner .scb-btn.primary { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); border: none; color: #fff; }
.sub-cancel-banner .scb-btn.primary:hover { background: linear-gradient(135deg, #fb923c 0%, #f97316 100%); }
.sub-cancel-banner .scb-btn.ghost { background: rgba(255,255,255,0.8); border: 1px solid rgba(249,115,22,0.4); color: #b45309; }
.sub-cancel-banner .scb-btn.ghost:hover { background: rgba(255,255,255,0.95); }
.sub-cancel-banner .scb-value-pulse { animation: scbPulse 600ms ease forwards; }
@keyframes scbPulse {
	0% { transform: scale(1); }
	45% { transform: scale(1.08); }
	100% { transform: scale(1); }
}
@media (max-width: 900px) {
	.sub-cancel-banner { padding: 18px; }
	.sub-cancel-banner .scb-body { grid-template-columns: 1fr; }
	.sub-cancel-banner .scb-countdown { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
}

/* Overview Upgrade */
.overview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.greeting .hello { font-size: 18px; font-weight: 700; }
.greeting .subtext { font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; padding: 16px; }
.stat-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: #fff6f3; border: 1px solid rgba(232,67,31,0.15); }
.stat-meta .label { font-size: 12px; color: var(--muted); }
.stat-meta .value { font-size: 16px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border); background: #f9fafb; color: var(--text); font-size: 12px; }
.badge.ok { color: #0a7d33; background: #e9f9ef; border-color: #c8f0d7; }
.badge.warn { color: #8a5a00; background: #fff7e6; border-color: #ffe2a8; }
.badge.danger { color: #a31212; background: #ffe8e8; border-color: #ffc5c5; }
/* Subtle row highlights for referral status are applied inline in JS to avoid breaking table layout */

.pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #f3f4f6; border: 1px solid var(--border); font-size: 12px; }

.overview-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; }
.card.big { padding: 20px; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 12px; margin: 6px 0 8px; }
.summary .kv { display: grid; gap: 4px; }
.summary .kv span { color: var(--muted); font-size: 12px; }
/* Discounted amount styling */
.summary .amount-original,
.stat-meta .amount-original {
	color: var(--muted);
	font-size: 13px;
	text-decoration: line-through;
	margin-right: 6px;
}
.summary .amount-discounted,
.stat-meta .amount-discounted {
	color: var(--text);
	font-weight: 700;
	font-size: 16px;
}
/* Keep labels small but allow explicit value blocks to override */
.summary .kv .rate-value span { color: inherit; font-size: inherit; }
.rate-split { display: grid; grid-template-columns: repeat(2, minmax(80px, 1fr)); gap: 12px; align-items: end; }
.rate-split .rate-value { font-size: 24px; font-weight: 800; line-height: 1; }
.rate-split .rate-label { font-size: 12px; color: var(--muted); }
/* Ensure numeric value inside span isn't shrunk by generic span rules */
.rate-value span { font-size: inherit; color: inherit; font-weight: inherit; }
/* Override higher-specificity rule .summary .kv span to keep number same size as % */
.summary .kv .rate-value span { font-size: inherit; color: inherit; font-weight: inherit; }
/* Same fix for settings summary where value is inside a strong > span */
.kvs strong span { font-size: inherit; color: inherit; font-weight: inherit; }
.overview-grid .card { position: relative; overflow: hidden; }
.overview-grid .card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(600px 200px at -10% -20%, rgba(232,67,31,0.03), transparent 60%), radial-gradient(500px 200px at 110% 120%, rgba(21,88,214,0.04), transparent 60%); }
.overview-grid h3 { margin-top: 0; }

@media (max-width: 960px) {
	.overview-grid { grid-template-columns: 1fr; }
}

.table { width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.table table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table th { text-align: left; color: var(--muted); background: var(--table-header-bg, #f9fafb); position: sticky; top: 0; }
.table .readonly { color: var(--text); }
input.cell { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--input-bg, #ffffff); }
.table input.cell, .table input.cellf { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg, #ffffff); }

/* Trade Analysis: ensure week PnL header stays visible and width respected */
#section-tradeanalysis #ta-cal-wrap table thead th:last-child { width: 120px !important; text-align: right; }
#section-tradeanalysis #ta-cal-wrap table tbody td:last-child { width: 120px !important; }

/* Positions tabs */
#section-positions .btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-bg-subtle, rgba(232, 67, 31, 0.08)); }
#section-positions .pos-symbol { white-space: nowrap; }
#section-positions .pos-side.long { color: var(--pos-long, #0a7d33); font-weight: 700; }
#section-positions .pos-side.short { color: var(--pos-short, #a31212); font-weight: 700; }
#section-positions .compact .table { max-height: 180px; height: 180px; }
#section-positions tr.gain td { background: var(--gain-bg, rgba(34, 197, 94, 0.08)); }
#section-positions tr.loss td { background: var(--loss-bg, rgba(239, 68, 68, 0.08)); }

/* Compact labels above each table when compact mode is on */
#section-positions .compact-label { 
    display: block; 
    position: sticky; 
    top: 0; 
    z-index: 2; 
    padding: 6px 10px; 
    background: var(--surface); 
    border-bottom: 2px solid var(--primary); 
    font-weight: 700; 
}

/* Sortable table headers with direction indicators */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable::after { content: ""; margin-left: 6px; }
.table th.sortable[data-dir="asc"]::after { content: "▲"; }
.table th.sortable[data-dir="desc"]::after { content: "▼"; }

/* Icon buttons in tables */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: #ffffff; color: var(--muted); cursor: pointer; transition: 120ms; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: #fff6f3; }
.icon-actions { display: inline-flex; gap: 6px; }

/* Accounts table: tighten spacing between actions and Active */
#followers-table table thead th:first-child { width: 120px; }
#followers-table table tbody td:first-child { width: 120px; white-space: nowrap; }
#followers-table table thead th:nth-child(2) { width: 80px; }
#followers-table table tbody td:nth-child(2) { width: 80px; }

/* Users table: force single-line rows and widen server column */
#users-table table { table-layout: auto; }
#users-table table th, #users-table table td { white-space: nowrap; }
#users-table table td .readonly { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
#users-table table thead th:first-child { width: 64px; }
#users-table table thead th:nth-child(2) { width: 84px; }
#users-table table thead th:nth-child(3) { width: 160px; }
#users-table table thead th:nth-child(4) { width: 220px; }
#users-table table thead th:nth-child(5) { width: 260px; }
#users-table table thead th:nth-child(6) { width: 120px; }
#users-table table thead th:nth-child(7) { width: 200px; }
#users-table table thead th:nth-child(8) { width: 60px; }

/* Toggle switch */
.toggle { position: relative; width: 40px; height: 22px; background: #e5e7eb; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; transition: background 160ms ease, border-color 160ms ease; display: inline-block; vertical-align: middle; }
.toggle.on { background: #e9f9ef; border-color: #c8f0d7; }
.toggle .knob { position: absolute; top: 1px; left: 1px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; border: 1px solid var(--border); transition: transform 160ms ease, background 160ms ease, border-color 160ms ease; box-shadow: var(--shadow); }
.toggle.on .knob { transform: translateX(18px); border-color: #96e1b6; }

/* Dark mode toggle switch */
body.dark-theme .toggle {
	background: #374151;
	border-color: #4b5563;
}
body.dark-theme .toggle.on {
	background: rgba(34, 197, 94, 0.25);
	border-color: #22c55e;
}
body.dark-theme .toggle .knob {
	background: #1f2937;
	border-color: #4b5563;
}
body.dark-theme .toggle.on .knob {
	background: #22c55e;
	border-color: #16a34a;
}

/* Modal */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(21,25,34,0.36); padding: 16px; }
.modal .dialog { width: 100%; max-width: 760px; background: #ffffff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; max-height: 90vh; }
.modal .dialog .head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #ffffff; z-index: 1; }
.modal .dialog .body { padding: 16px 18px; display: grid; gap: 12px; flex: 1 1 auto; min-height: 0; overflow: auto; }
.modal .dialog .footer { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; position: sticky; bottom: 0; background: #ffffff; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .field { display: grid; gap: 6px; }
.form-grid .field label { font-weight: 600; font-size: 12px; color: var(--muted); }
.form-grid .field input, .form-grid .field select, .form-grid .field textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #ffffff; color: var(--text); }
.form-grid .full { grid-column: 1 / -1; }

/* Symbol mapping visual rows */
.map-rows { display: grid; gap: 8px; }
.map-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.map-row .arrow { color: var(--muted); }

.modal .modal-dialog { max-width: 760px; width: 100%; }
.modal .modal-head { padding: 16px; }
.modal .modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px; }
.modal .modal-footer { padding: 16px; }

.vendor-search { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.vendor-search-input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.vendor-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.vendor-grid.hidden { display: none; }
.vendor-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 10px; aspect-ratio: 3/2; position: relative; cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease; border: none; background: #ffffff; }
.vendor-card:not([disabled]):hover,
.vendor-card:not([disabled]):hover,
.vendor-card:not([disabled]):focus-visible { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,0.14); }
.vendor-card:focus-visible { outline: 3px solid rgba(232,67,31,0.4); outline-offset: 2px; }
.vendor-card[disabled] { cursor: not-allowed; opacity: 0.55; }
.vendor-card-logo { display: flex; align-items: center; justify-content: center; height: 70%; width: 100%; }
.vendor-card-logo img { max-height: 100%; max-width: 100%; object-fit: contain; }
.vendor-card-note { width: 100%; margin-top: auto; padding: 6px 8px; font-size: 12px; color: #b91c1c; background: #fee2e2; border-radius: 6px; text-align: center; }
.vendor-detail { display: none; }
.vendor-detail.hidden { display: none; }
.vendor-detail:not(.hidden) { display: block; }
.vendor-detail-inner { padding: 16px; display: grid; gap: 14px; }
.vendor-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vendor-back { background: #f9fafb; }
.vendor-detail-logo { height: 54px; max-width: 100%; object-fit: contain; }
.vendor-detail-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #334155; background: #f1f5f9; border-radius: 8px; padding: 8px 10px; }
.vendor-detail-form { flex: 1; }
.vendor-detail-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.vendor-detail-actions .btn { min-width: 160px; }

.map-row { grid-template-columns: 1fr auto 1fr auto; }

.modal .dialog .body .map-rows { max-height: 240px; overflow: auto; padding-right: 4px; }
.map-row button { align-self: stretch; }

.downloads { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dl { padding: 16px; display: grid; gap: 8px; }
.dl .os { font-weight: 700; }
.dl .tag { font-size: 12px; color: var(--muted); }
.dl .cta { margin-top: 8px; }

/* Economic Calendar */
.cal-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; }
.cal-controls .group { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: #ffffff; }
.cal-controls label { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-controls .chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #ffffff; padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.cal-controls .chip input { accent-color: var(--primary); }
.cal-controls .chip .star-1 { color: #f2c94c; }
.cal-controls .chip .star-2 { color: #f2994a; }
.cal-controls .chip .star-3 { color: #eb5757; }
.cal-controls .chip .tier1 { color: #eb5757; font-weight: 800; }
.cal-controls .spacer { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }
.cal-controls .switch-row { display: inline-flex; align-items: center; gap: 8px; }

#calendar-table { overflow: auto; }
#calendar-table table { width: 100%; border-collapse: collapse; }
#calendar-table thead th { position: sticky; top: 0; background: #f9fafb; z-index: 1; }
#calendar-table th, #calendar-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
#calendar-table .date-row td { background: #fff6f3; color: var(--primary); font-weight: 800; }
#calendar-table .imp-1 { color: #f2c94c; font-weight: 700; }
#calendar-table .imp-2 { color: #f2994a; font-weight: 700; }
#calendar-table .imp-3 { color: #eb5757; font-weight: 700; }
#calendar-table .imp-4 { color: #eb5757; font-weight: 800; }

.toast { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast .item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; background: #ffffff; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); min-width: 280px; }
.toast .item .title { font-weight: 700; }
.toast .item .time { color: var(--muted); font-size: 12px; }
.toast .item .close { width: 28px; height: 28px; }

/* Collapsed sidebar for admin mode */
.sidebar.collapsed-admin { width: 70px; padding: 16px 8px; }
.sidebar.collapsed-admin .sidebar-header { flex-direction: column; gap: 4px; }
.sidebar.collapsed-admin .sidebar-header img { width: 32px; height: 32px; }
.sidebar.collapsed-admin .sidebar-header .user { display: none; }
.sidebar.collapsed-admin .side-nav { gap: 4px; overflow-y: auto; }
.sidebar.collapsed-admin .side-link { grid-template-columns: 1fr; justify-items: center; padding: 12px 8px; }
.sidebar.collapsed-admin .side-link span { display: none; }
.sidebar.collapsed-admin .side-link .icon { margin: 0; }
.sidebar.collapsed-admin .side-sep { margin: 4px 0; }
.sidebar.collapsed-admin .nav-expandable { gap: 4px; }
.sidebar.collapsed-admin .nav-expand-toggle { grid-template-columns: 1fr; }
.sidebar.collapsed-admin .nav-expand-toggle .expand-arrow { display: none; }
.sidebar.collapsed-admin .side-link:has(.nav-badge) { grid-template-columns: 1fr; }
.sidebar.collapsed-admin .nav-sub-item { grid-template-columns: 1fr; justify-items: center; padding: 12px 8px !important; border-left: none; }
.sidebar.collapsed-admin .nav-sub-item:has(.nav-badge) { grid-template-columns: 1fr; }
.sidebar.collapsed-admin .nav-sub-item .icon { margin: 0; }
.sidebar.collapsed-admin .nav-sub-item span { display: none; }
.sidebar.collapsed-admin .nav-badge { display: none; }
.sidebar.collapsed-admin .nav-badge span { animation: none; }
.sidebar.collapsed-admin .side-bottom { gap: 4px; }
.sidebar.collapsed-admin .side-bottom .btn { 
	padding: 10px; 
	font-size: 0; 
	width: 100%; 
	min-height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.sidebar.collapsed-admin .side-bottom .btn span { display: none; }
.sidebar.collapsed-admin .side-bottom .btn i { font-size: 16px; margin: 0; }
.dashboard:has(.sidebar.collapsed-admin) { grid-template-columns: 70px 1fr; }

/* Admin sidebar wrapper */
.admin-sidebar-wrap { overflow-y: auto; }
.admin-sidebar-wrap .side-link { font-size: 14px; }

/* Responsive */
@media (max-width: 960px) {
	.dashboard { grid-template-columns: 1fr; }
	.sidebar { position: sticky; top: 0; z-index: 2; }
	/* Disable collapsed admin mode on mobile */
	.sidebar.collapsed-admin { width: 260px; padding: 16px; }
	.sidebar.collapsed-admin .sidebar-header { flex-direction: row; gap: 8px; }
	.sidebar.collapsed-admin .sidebar-header .user { display: inline-flex; }
	.sidebar.collapsed-admin .side-link { grid-template-columns: 20px 1fr; justify-items: start; padding: 10px 12px; }
	.sidebar.collapsed-admin .side-link span { display: block; }
	.sidebar.collapsed-admin .side-link:has(.nav-badge) { grid-template-columns: 20px 1fr auto; }
	.sidebar.collapsed-admin .nav-expand-toggle { grid-template-columns: 20px 1fr 16px; }
	.sidebar.collapsed-admin .nav-expand-toggle .expand-arrow { display: block; }
	.sidebar.collapsed-admin .nav-sub-item { grid-template-columns: 20px 1fr; justify-items: start; padding-left: 24px !important; border-left: 2px solid transparent; }
	.sidebar.collapsed-admin .nav-sub-item:has(.nav-badge) { grid-template-columns: 20px 1fr auto; }
	.sidebar.collapsed-admin .nav-sub-item span { display: block; }
	.sidebar.collapsed-admin .nav-badge { display: inline-flex; }
	.sidebar.collapsed-admin .side-bottom .btn { 
		font-size: inherit; 
		padding: 10px 12px; 
		display: block;
		width: 100%;
		min-height: auto;
	}
	.sidebar.collapsed-admin .side-bottom .btn span { display: inline; }
	.sidebar.collapsed-admin .side-bottom .btn i { margin-right: 8px; }
	.dashboard:has(.sidebar.collapsed-admin) { grid-template-columns: 1fr; }
	/* Admin sidebar adjustments for mobile */
	.admin-sidebar-wrap { width: 100% !important; position: relative !important; height: auto !important; margin-left: 0 !important; }
}

/* Mobile top bar and off-canvas sidebar */
.mobile-topbar { display: none; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40; }
body.no-scroll { overflow: hidden; }

@media (max-width: 960px) {
	.mobile-topbar { position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 8px 12px; z-index: 46; }
	.mobile-topbar .mobile-topbar-title { font-weight: 700; margin-left: 6px; }
	.dashboard { margin-top: var(--topbar-h); }
	/* Turn sidebar into off-canvas drawer */
	.sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 260px; transform: translateX(-110%); transition: transform 200ms ease; z-index: 45; overflow: auto; }
	.sidebar.open { transform: translateX(0); }
	/* Prevent bottom buttons from overlapping content on mobile */
	.side-bottom { position: static; left: auto; bottom: auto; width: auto; margin-top: 12px; }
	.side-bottom .btn { width: 100%; }
	/* Backdrop visibility controlled by .hidden toggle */
	.backdrop.hidden { display: none !important; }
}


/* Positions: mobile stacked rows */
@media (max-width: 760px) {
	#section-positions .table table,
	#section-positions .table thead,
	#section-positions .table tbody,
	#section-positions .table th,
	#section-positions .table td,
	#section-positions .table tr { display: block; width: 100%; }
	#section-positions .table thead { position: absolute; left: -9999px; top: -9999px; height: 0; width: 0; overflow: hidden; }
	#section-positions .table tbody { display: block; }
	#section-positions .table tr { border: 1px solid var(--border); border-radius: 10px; margin: 8px 0; padding: 0; overflow: hidden; }
	#section-positions .table td { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; border: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; }
	#section-positions .table td:last-child { border-bottom: 0; }
	#section-positions .table td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: left; }
	#section-positions .icon-actions, #section-positions .icon-btn { justify-self: end; }
	#section-positions .pos-symbol { white-space: normal; }
	#section-positions tr.gain td { background: transparent; }
	#section-positions tr.loss td { background: transparent; }
	#section-positions tr.gain { background: rgba(34, 197, 94, 0.08); }
	#section-positions tr.loss { background: rgba(239, 68, 68, 0.08); }
}

/* Gating: disable nav items when subscription inactive */
.side-link.disabled { opacity: 0.5; pointer-events: none; }


/* Guided tutorial overlay */
.tutorial-overlay { position: fixed; inset: 0; z-index: 1600; display: flex; align-items: center; justify-content: center; pointer-events: none; font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.tutorial-overlay.hidden { display: none !important; }
.tutorial-overlay.is-spotlight { align-items: stretch; justify-content: stretch; }
.tutorial-backdrop { position: absolute; inset: 0; background: rgba(255,255,255,0.86); transition: opacity 200ms ease; pointer-events: auto; }
.tutorial-overlay.is-spotlight .tutorial-backdrop { opacity: 0; pointer-events: none; }
.tutorial-skip { position: absolute; top: 24px; right: 24px; z-index: 5; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(148,163,184,0.4); background: rgba(255,255,255,0.9); color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; cursor: pointer; backdrop-filter: blur(12px); transition: background 160ms ease, transform 160ms ease, border-color 160ms ease; pointer-events: auto; }
.tutorial-skip:hover { background: #f8fafc; border-color: rgba(148,163,184,0.6); transform: translateY(-1px); }
.tutorial-modal { position: relative; z-index: 4; width: min(440px, 92vw); border-radius: 20px; background: #ffffff; color: var(--text); padding: 32px; display: grid; gap: 24px; box-shadow: 0 30px 70px rgba(15,23,42,0.18); border: 1px solid rgba(148,163,184,0.2); pointer-events: auto; }
.tutorial-modal.hidden { display: none; }
.tutorial-modal-body { display: grid; gap: 12px; }
.tutorial-modal-body h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.tutorial-modal-body p { margin: 0; font-size: 15px; line-height: 1.65; color: #4b5563; }
.tutorial-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tutorial-modal-actions .btn { flex: 1 1 0; justify-content: center; border-radius: 999px; font-weight: 600; }
.tutorial-modal-actions .btn.primary { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.tutorial-modal-actions .btn.primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.tutorial-modal-actions .btn.ghost { background: #f1f5f9; border-color: #e2e8f0; color: #1f2937; }
.tutorial-modal-actions .btn.ghost:hover { background: #e2e8f0; }
.tutorial-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; background: #eef2ff; color: #312e81; }
.tutorial-modal-body .tutorial-badge { justify-self: flex-start; }
.tutorial-spotlight { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tutorial-spotlight.hidden { display: none; }
.tutorial-highlight { position: absolute; border-radius: 16px; border: 2px solid var(--primary); box-shadow: 0 0 0 2000px rgba(255,255,255,0.7), 0 20px 40px rgba(37,99,235,0.25); background: rgba(255,255,255,0.2); transition: transform 200ms ease, width 200ms ease, height 200ms ease; pointer-events: none; }
.tutorial-tooltip { position: absolute; max-width: 320px; background: #ffffff; border-radius: 18px; padding: 20px 22px; color: #1f2937; box-shadow: 0 20px 48px rgba(15,23,42,0.16); border: 1px solid rgba(148,163,184,0.25); pointer-events: auto; --tutorial-arrow-offset-x: 32px; --tutorial-arrow-offset-y: 32px; }
.tutorial-tooltip::before { content: ""; position: absolute; width: 16px; height: 16px; transform: rotate(45deg); background: inherit; border: 1px solid rgba(148,163,184,0.25); z-index: -1; }
.tutorial-tooltip[data-placement="bottom"]::before { top: -8px; left: calc(var(--tutorial-arrow-offset-x) - 8px); border-bottom: none; border-right: none; }
.tutorial-tooltip[data-placement="top"]::before { bottom: -8px; left: calc(var(--tutorial-arrow-offset-x) - 8px); border-top: none; border-left: none; }
.tutorial-tooltip[data-placement="right"]::before { left: -8px; top: calc(var(--tutorial-arrow-offset-y) - 8px); border-right: none; border-bottom: none; }
.tutorial-tooltip[data-placement="left"]::before { right: -8px; top: calc(var(--tutorial-arrow-offset-y) - 8px); border-left: none; border-top: none; }
.tutorial-tooltip h3 { margin: 8px 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.tutorial-tooltip p { margin: 0; font-size: 14px; line-height: 1.6; color: #4b5563; }
.tutorial-tooltip .tutorial-actions { display: flex; gap: 8px; margin-top: 16px; }
.tutorial-tooltip .tutorial-actions.hint-only { display: block; margin-top: 18px; }
.tutorial-tooltip .btn { flex: 1 1 0; justify-content: center; border-radius: 999px; font-weight: 600; }
.tutorial-tooltip .btn.primary { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.tutorial-tooltip .btn.primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.tutorial-tooltip .btn.ghost { background: #f1f5f9; border-color: #e2e8f0; color: #1f2937; }
.tutorial-tooltip .btn.ghost:hover { background: #e2e8f0; }
.tutorial-tooltip .tutorial-hint { font-size: 13px; line-height: 1.55; color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 14px; }

@media (max-width: 600px) {
	.tutorial-modal { padding: 24px; border-radius: 16px; }
	.tutorial-modal-body h2 { font-size: 24px; }
	.tutorial-modal-body p { font-size: 14px; }
	.tutorial-modal-actions { flex-direction: column; }
	.tutorial-tooltip { max-width: min(88vw, 320px); padding: 18px; }
	.tutorial-skip { top: 12px; right: 12px; }
}

@media (max-width: 720px) {
	.modal .dialog { max-width: 96vw; border-radius: 16px; }
	.modal .dialog .body { padding: 16px 14px; }
	.modal .dialog .footer { flex-wrap: wrap; }
	.modal .dialog .footer .btn { flex: 1 1 100%; justify-content: center; }
	.modal .dialog .head { padding: 14px; }
	.vendor-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
	.vendor-detail-inner { padding: 14px; }
	.vendor-detail-actions { justify-content: stretch; }
	.vendor-detail-actions .btn { flex: 1 1 100%; }
	.form-grid { grid-template-columns: 1fr; }
}

.faq-wrapper { display: grid; gap: 18px; }
.faq-header { padding: 22px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.faq-header-copy { flex: 1 1 260px; min-width: 220px; }
.faq-header h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.faq-header p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.faq-search-wide { flex: 1 1 320px; min-width: 240px; }
.faq-stage { padding: 22px; display: grid; gap: 20px; transition: opacity 180ms ease, transform 180ms ease; }
.faq-stage.hidden { display: none; }
.faq-stage-head { display: grid; gap: 8px; }
.faq-stage-head h3 { margin: 0; font-size: 20px; font-weight: 700; }
.faq-stage-head p { margin: 0; font-size: 14px; color: var(--muted); }
.faq-category-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.faq-cat { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: #ffffff; text-align: left; cursor: pointer; transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; position: relative; }
.faq-cat:hover { border-color: rgba(232,67,31,0.4); box-shadow: 0 12px 30px rgba(15,23,42,0.1); transform: translateY(-2px); }
.faq-cat::after { content: ""; position: absolute; inset: 18px; border-radius: 14px; border: 2px solid transparent; transition: border-color 160ms ease; }
.faq-cat:focus-visible::after { border-color: rgba(232,67,31,0.6); }
.faq-cat-icon { width: 56px; height: 56px; padding: 10px; border-radius: 16px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; background: #f8fafc; overflow: hidden; }
.faq-cat-icon img { width: 100%; height: 100%; object-fit: contain; }
.faq-cat-placeholder { font-size: 28px; color: #ff9800; }
.faq-cat-meta { display: grid; gap: 6px; min-width: 0; }
.faq-cat-meta strong { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faq-cat-meta span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.faq-cat-count { justify-self: start; font-size: 12px; font-weight: 600; color: var(--muted); background: #f1f5f9; border-radius: 999px; padding: 4px 10px; }
.faq-cat.active { border-color: rgba(232,67,31,0.6); background: linear-gradient(135deg, rgba(255,241,235,0.9) 0%, rgba(255,255,255,0.95) 100%); box-shadow: 0 16px 36px rgba(232,67,31,0.16); }
.faq-stage-toolbar { display: flex; gap: 16px; align-items: center; justify-content: flex-start; }
.faq-search-field.disabled { opacity: 0.5; pointer-events: none; }
.faq-search-field { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #ffffff; }
.faq-search-field i { color: var(--muted); }
.faq-search-field input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; }
.faq-stage-body { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 20px; align-items: start; min-height: 0; }
.faq-list-column { display: grid; gap: 12px; align-content: start; }
.faq-breadcrumb { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.faq-breadcrumb .current { color: var(--text); font-weight: 600; }
.faq-results { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: 16px; padding: 12px; max-height: 700px; overflow: auto; background: #f8fafc; }
.faq-result { text-align: left; border: none; background: #ffffff; border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text); cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; width: 100%; transition: transform 160ms ease, box-shadow 160ms ease; }
.faq-result:hover { transform: translateX(4px); box-shadow: 0 8px 20px rgba(15,23,42,0.08); }
.faq-result.active { background: linear-gradient(135deg, rgba(232,67,31,0.12) 0%, rgba(255,255,255,0.92) 100%); border: 1px solid rgba(232,67,31,0.4); box-shadow: 0 12px 26px rgba(232,67,31,0.14); }
.faq-result-icon { width: 36px; height: 36px; padding: 4px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.faq-result-icon img { width: 100%; height: 100%; object-fit: contain; }
.faq-result-content { display: grid; gap: 4px; align-items: start; text-align: left; }
.faq-result-title { line-height: 1.4; font-weight: 600; }
.faq-result-meta { font-size: 12px; color: var(--muted); }
.faq-detail { border: 1px solid var(--border); border-radius: 16px; padding: 18px; background: #ffffff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.6); max-height: 700px; overflow: auto; }
.faq-detail-head { display: grid; gap: 6px; margin-bottom: 12px; }
.faq-detail-head h3 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.faq-detail-meta span { font-size: 12px; color: var(--muted); font-weight: 600; }
.faq-detail-body { font-size: 14px; line-height: 1.7; color: var(--text); }
.faq-detail-body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.faq-detail-body table td, .faq-detail-body table th { padding: 8px; border: 1px solid rgba(229,231,235,0.6); }
.faq-empty { padding: 24px; text-align: center; color: var(--muted); }
.faq-modal { display: grid; gap: 12px; font-size: 14px; line-height: 1.7; }
.faq-modal .faq-modal-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #ff7a00; }

@media (max-width: 960px) {
	.faq-stage-body { grid-template-columns: 1fr; }
	.faq-detail { max-height: none; }
}

@media (max-width: 600px) {
	.faq-header { padding: 18px; }
	.faq-stage { padding: 18px; }
	.faq-stage-toolbar { flex-direction: column; align-items: stretch; }
	.faq-search-wide { width: 100%; }
}

