/* ─── Trading Platform — variant3 card style ─── */

:root {
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-input: #f5f6f8;
  --text: #1a1a2e;
  --text-sec: #6b7280;
  --border: #e5e7eb;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --green: #10b981;
  --green-bg: rgba(16,185,129,.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,.1);
  --yellow: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: .2s ease;
}

[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #16162a;
  --text: #e4e4f0;
  --text-sec: #8b8ca7;
  --border: #2a2a40;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.4);
}

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

html, body, #app, #login-screen, .container, .tab-content {
  overflow-x: clip !important;
  max-width: 100% !important;
}

html {
  width: 100%;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-overflow-scrolling: touch;
  width: 100%;
  position: relative;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

#app {
  width: 100%;
}

/* ─── Login Screen ─── */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
}

.login-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 8s ease-in-out infinite;
}

.login-glow-1 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #818cf8 0%, transparent 70%);
  top: -80px; right: -50px;
  animation-delay: 0s;
}

.login-glow-2 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  bottom: -60px; left: -40px;
  animation-delay: -3s;
}

.login-glow-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, #a78bfa 0%, transparent 70%);
  top: 40%; left: 50%;
  transform: translateX(-50%);
  animation-delay: -5s;
  opacity: 0.2;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(20px, -30px) scale(1.05); }
  50% { transform: translate(-10px, 20px) scale(0.95); }
  75% { transform: translate(15px, 10px) scale(1.02); }
}

.login-card {
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(129, 140, 248, 0.15);
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4), 0 0 80px rgba(99,102,241,0.08);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: cardAppear 0.6s ease-out;
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  margin-bottom: 20px;
  display: inline-block;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: rgba(255,255,255,0.5);
  margin-bottom: 32px;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  margin-bottom: 6px;
}

#login-screen .form-group label {
  color: rgba(255,255,255,0.6);
}

.form-group input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: all var(--transition);
}

.form-group input::placeholder {
  color: rgba(255,255,255,0.3);
}

.form-group input:focus {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* App form inputs (non-login) */
#app .form-group label {
  color: var(--text-sec);
}

#app .form-group input {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}

#app .form-group input:focus {
  border-color: var(--accent);
  background: var(--bg-input);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff;
  width: 100%;
  font-weight: 600;
  font-size: 15px;
  padding: 14px 24px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99,102,241,0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(99,102,241,0.3);
}

.login-error {
  color: #f87171;
  font-size: 13px;
  margin-top: 12px;
  display: none;
  background: rgba(239,68,68,0.1);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,0.2);
}

.login-footer {
  margin-top: 20px;
  font-size: 13px;
}

.login-footer a {
  color: rgba(129,140,248,0.8);
  text-decoration: none;
  transition: color var(--transition);
}

.login-footer a:hover {
  color: #818cf8;
  text-decoration: underline;
}

/* ─── Main Layout ─── */

#app { display: none; }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.navbar-brand .logo { font-size: 24px; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─── Hamburger & Sidebar ─── */

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.hamburger-btn:hover { background: var(--bg-input); }

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.open { display: block; }

.sidebar {
  position: fixed;
  top: 0; left: -280px;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 1000;
  transition: left .3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.sidebar.open { left: 0; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Блокируем скролл body когда sidebar открыт */
body.sidebar-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo { font-size: 22px; }
.sidebar-title { font-weight: 700; font-size: 16px; }

.sidebar-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-sec);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all var(--transition);
}
.sidebar-close:hover { background: var(--bg-input); color: var(--text); }

.sidebar-search {
  padding: 12px 16px 4px;
}

.sidebar-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.sidebar-search input:focus { border-color: var(--accent); }

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  gap: 12px;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--bg-input); }
.sidebar-item.active {
  background: rgba(99,102,241,0.1);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.si-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.si-text { flex: 1; }
.si-arrow { color: var(--text-sec); font-size: 16px; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

.sidebar-label {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sec);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 768px) {
  .hamburger-btn { display: block; }
  .tabs-nav { display: none !important; }
}

/* Унифицируем mobile/tablet layout (Safari/Chrome одинаково) */
@media (max-width: 1024px) {
  .strategies-grid { grid-template-columns: 1fr !important; }

  .strategy-detail-header {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title title"
      "back settings";
    align-items: center !important;
    gap: 10px !important;
  }
  .strategy-detail-title {
    grid-area: title !important;
    width: 100% !important;
  }
  #btn-strategy-back {
    grid-area: back !important;
    justify-self: start !important;
    margin: 0 !important;
  }
  #btn-strategy-settings {
    grid-area: settings !important;
    justify-self: end !important;
    margin: 0 !important;
  }
}

/* Для Chrome на телефонах (в т.ч. если включён desktop mode) */
@media (hover: none) and (pointer: coarse) {
  .hamburger-btn { display: block !important; }
  .tabs-nav { display: none !important; overflow-x: hidden !important; }

  .strategy-detail-header {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title title"
      "back settings";
    align-items: center !important;
    gap: 10px !important;
  }
  .strategy-detail-title {
    grid-area: title !important;
    width: 100% !important;
  }
  #btn-strategy-back {
    grid-area: back !important;
    justify-self: start !important;
    margin: 0 !important;
  }
  #btn-strategy-settings {
    grid-area: settings !important;
    justify-self: end !important;
    margin: 0 !important;
  }
}

@media (min-width: 769px) {
  .sidebar, .sidebar-overlay { display: none !important; }
}

/* ─── Tabs Navigation ─── */

.tabs-nav {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.tabs-nav::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.tab-btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-sec);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-input);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.theme-toggle:hover { border-color: var(--accent); }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.offline { background: var(--red); }

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sec);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  overflow-x: hidden;
}

.tab-content {
  overflow-x: hidden;
  max-width: 100%;
}

/* Anti horizontal overflow safety */
.stats-row,
.strategies-grid,
.analytics-grid,
.strategy-two-column-layout,
.strategy-left-column,
.strategy-right-column,
.strategy-detail-header,
.pnl-section,
.analytics-section {
  min-width: 0;
  max-width: 100%;
}

/* ─── Stats Row ─── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-label {
  font-size: 13px;
  color: var(--text-sec);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

.stat-sub {
  font-size: 12px;
  color: var(--text-sec);
  margin-top: 4px;
}

/* ─── Strategy Cards ─── */

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-sec);
}

.strategies-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  max-width: 100%;
  overflow: hidden;
}

.strategy-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.strategy-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.strategy-card.active { border-color: var(--accent); background: rgba(99,102,241,.05); }

.strategy-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.strategy-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.strategy-desc {
  font-size: 13px;
  color: var(--text-sec);
}

/* ─── Control Panel ─── */

.control-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.btn-start {
  background: var(--green);
  color: #fff;
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-sm);
}

.btn-start:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-stop {
  background: var(--red);
  color: #fff;
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-sm);
}

.btn-stop:hover { filter: brightness(1.1); transform: translateY(-1px); }

.bot-status-text {
  font-size: 14px;
  color: var(--text-sec);
}

.bot-status-text strong { color: var(--text); }

/* ─── Trades Table ─── */

.trades-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.trades-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.trades-header h3 { font-size: 16px; font-weight: 600; }

.trades-table {
  width: 100%;
  border-collapse: collapse;
}

.trades-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}

.trades-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.trades-table tr:last-child td { border-bottom: none; }

.trades-table tr:hover { background: var(--bg-input); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-call { background: var(--green-bg); color: var(--green); }
.badge-put { background: var(--red-bg); color: var(--red); }
.badge-win { background: var(--green-bg); color: var(--green); }
.badge-loss { background: var(--red-bg); color: var(--red); }
.badge-pending { background: rgba(245,158,11,.1); color: var(--yellow); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-sec);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ─── Log Panel ─── */

.log-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-panel .trades-header { cursor: pointer; }

.log-entries {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.8;
}

.log-entry {
  padding: 2px 0;
  color: var(--text-sec);
}

.log-entry .time { color: var(--accent); }

/* ─── Toasts ─── */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  animation: slideIn .3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(50px); }
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
  .navbar { padding: 12px 16px; }
  .tabs-nav { padding: 12px 8px; gap: 4px; }
  .container { padding: 12px; overflow-x: hidden; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .strategies-grid { grid-template-columns: repeat(2, 1fr); overflow: hidden; }
  .control-panel { flex-direction: column; align-items: stretch; }
  .btn-start, .btn-stop { width: 100%; }
  .trades-table { font-size: 12px; }
  .trades-table th, .trades-table td { padding: 8px 10px; }
  .settings-panel { padding: 24px 16px; }
  .setting-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .toggle { margin-left: auto; }
  .param-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .param-row input[type="number"],
  .param-row select { width: 100%; }
  .trading-params { gap: 12px; }
  .profile-panel { padding: 24px 16px; }
  .strategy-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .strategy-detail-title {
    order: 1;
    width: 100%;
  }
  #btn-strategy-back {
    order: 2;
    margin-right: auto;
  }
  #btn-strategy-settings {
    order: 3;
    margin-left: auto;
  }
  .signal-feed-item .time { min-width: 80px; font-size: 11px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .strategies-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 24px; }
  .stat-value { font-size: 22px; }
  .tab-btn { font-size: 13px; padding: 8px 16px; }
  .settings-panel h2 { font-size: 20px; }
  .settings-section h3 { font-size: 16px; }
  .profile-panel h2 { font-size: 20px; }
  .profile-section h3 { font-size: 16px; }
  .connection-header { flex-direction: column; align-items: flex-start; }
  .connection-icon { font-size: 24px; }
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sec); }

/* ─── Two-Column Strategy Layout ─── */

.strategy-two-column-layout {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 24px;
  margin-top: 24px;
}

.strategy-left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.strategy-right-column {
  display: flex;
  flex-direction: column;
}

.strategy-specific-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.strategy-specific-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

@media (max-width: 768px) {
  .strategy-two-column-layout {
    grid-template-columns: 1fr;
  }
}

/* ─── Pattern Cards ─── */

.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pattern-card {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: all 0.2s;
  animation: fadeIn 0.3s ease;
}

.pattern-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.pattern-card.call {
  border-left: 4px solid var(--green);
}

.pattern-card.put {
  border-left: 4px solid var(--red);
}

.pattern-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pattern-asset {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pattern-time {
  font-size: 12px;
  color: var(--text-sec);
}

.pattern-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pattern-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.pattern-info {
  font-size: 12px;
  color: var(--text-sec);
}

.pattern-action {
  font-size: 13px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── Recommended Settings Hint ─── */

.recommended-settings-hint {
  display: flex;
  gap: 16px;
  background: linear-gradient(135deg, rgba(99,102,241,0.05) 0%, rgba(99,102,241,0.1) 100%);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.hint-icon {
  font-size: 32px;
  line-height: 1;
}

.hint-content {
  flex: 1;
}

.hint-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

#recommended-settings-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-sec);
}

/* ─── Users Table ─── */

.users-table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.users-table thead {
  background: var(--bg-input);
}

.users-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.users-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.users-table tbody tr:hover {
  background: var(--bg-input);
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Profile Panel ─── */

.profile-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.profile-panel h2 {
  font-size: 24px;
  font-weight: 700;
}

.profile-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.profile-section:last-of-type {
  border-bottom: none;
}

.profile-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sec);
}

.form-row input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border var(--transition);
}

.form-row input:focus {
  border-color: var(--accent);
}

.form-row input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Connection Cards ─── */

.connection-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  transition: all var(--transition);
}

.connection-card:hover {
  border-color: var(--accent);
}

.connection-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.connection-icon {
  font-size: 28px;
}

.connection-title {
  font-size: 16px;
  font-weight: 600;
}

.connection-status {
  font-size: 12px;
  color: var(--text-sec);
}

.connection-status.online {
  color: var(--green);
}

.connection-status.offline {
  color: var(--red);
}

/* ─── Platform Info ─── */

.platform-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.info-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sec);
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Strategy Detail View ─── */

.strategy-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.strategy-detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.strategy-detail-title h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.strategy-detail-title .badge {
  font-size: 13px;
}

.strategy-specific-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.strategy-specific-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.signal-feed {
  max-height: 400px;
  overflow-y: auto;
}

.signal-feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-input);
}

.signal-feed-item .time {
  font-size: 12px;
  color: var(--text-sec);
  min-width: 100px;
  font-family: monospace;
}

.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pattern-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.pattern-name {
  font-size: 14px;
  font-weight: 500;
}

.pattern-meta {
  font-size: 12px;
  color: var(--text-sec);
}

.position-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.position-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.position-asset {
  font-size: 16px;
  font-weight: 600;
}

.position-amount {
  font-size: 14px;
  color: var(--text-sec);
}

.position-pnl {
  font-size: 14px;
  font-weight: 600;
}

.position-pnl.positive {
  color: var(--green);
}

.position-pnl.negative {
  color: var(--red);
}

.position-levels {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.level {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-label {
  color: var(--text-sec);
}

.level-value {
  font-weight: 600;
}

/* ─── Pulse animation ─── */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.pulse { animation: pulse 2s ease-in-out infinite; }

/* ─── Strategy Settings Panel ─── */

.strategy-settings-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}

.strategy-settings-panel h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.strategy-settings-panel h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* ─── Signals Panel ─── */

.signals-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.signal-stats {
  font-size: 13px;
  color: var(--text-sec);
  font-weight: 500;
}

.signals-container {
  max-height: 600px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 768px) {
  .signals-container { grid-template-columns: 1fr; }
}

.signal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  animation: fadeIn 0.3s ease;
}

.signal-item:hover {
  box-shadow: var(--shadow);
}

.signal-item.call {
  border-left: 3px solid var(--green);
}

.signal-item.put {
  border-left: 3px solid var(--red);
}

.signal-time {
  font-size: 12px;
  color: var(--text-sec);
  min-width: 50px;
  font-family: monospace;
}

.signal-asset {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.signal-direction {
  font-weight: 700;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
}

.signal-direction.call {
  background: var(--green-bg);
  color: var(--green);
}

.signal-direction.put {
  background: var(--red-bg);
  color: var(--red);
}

.signal-new {
  animation: pulse 1s ease infinite;
}

/* ─── Telegram Signal Card ─── */

.telegram-signal-card {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
  animation: fadeIn 0.3s ease;
}

.telegram-signal-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.telegram-signal-card.call {
  border-left: 4px solid var(--green);
}

.telegram-signal-card.put {
  border-left: 4px solid var(--red);
}

.signal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.signal-direction-badge {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
}

.signal-direction-badge.call {
  background: var(--green-bg);
  color: var(--green);
}

.signal-direction-badge.put {
  background: var(--red-bg);
  color: var(--red);
}

.signal-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.signal-asset-big {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.signal-info {
  font-size: 14px;
  color: var(--text-sec);
  display: flex;
  gap: 8px;
}

.signal-info strong {
  color: var(--text);
  font-weight: 600;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── P&L Chart Section ─── */

.pnl-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.pnl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.pnl-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.pnl-filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pnl-chart-container {
  position: relative;
  height: 250px;
  max-height: 250px;
  width: 100%;
  overflow: hidden;
}

/* ─── Analytics Section ─── */

.analytics-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.analytics-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.analytics-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 120px;
  max-height: 200px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

.analytics-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.analytics-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analytics-card canvas {
  flex: 1;
  max-height: 100px;
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.asset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 13px;
}

.asset-name {
  font-weight: 600;
  color: var(--text);
}

.asset-pnl {
  font-weight: 600;
}

.asset-pnl.positive {
  color: var(--green);
}

.asset-pnl.negative {
  color: var(--red);
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  margin-top: auto;
  margin-bottom: 8px;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-sec);
}

.empty-state-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-sec);
  font-size: 13px;
}

@media (max-width: 1024px) {
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .pnl-chart-container {
    height: 180px;
    max-height: 180px;
  }

  .analytics-card {
    max-height: 160px;
  }

  .analytics-card canvas {
    max-height: 80px;
  }
  
  .pnl-filters {
    width: 100%;
    justify-content: space-between;
  }
  
  .filter-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .metric-value {
    font-size: 24px;
  }
}

/* ─── Settings Panel ─── */

.settings-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.settings-panel h2 {
  font-size: 24px;
  font-weight: 700;
}

.settings-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
  border-bottom: none;
}

.settings-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.setting-item:hover {
  background: var(--bg);
}

.setting-info {
  flex: 1;
}

.setting-info strong {
  font-size: 15px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.setting-info p {
  font-size: 13px;
  color: var(--text-sec);
  margin: 0;
}

/* ─── Toggle Switch ─── */

.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  transition: .3s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-inline {
  margin-left: 12px;
}

/* ─── Trading Params ─── */

.trading-params {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.param-row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.param-row input[type="number"],
.param-row select {
  width: 120px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border var(--transition);
}

.param-row input[type="number"]:focus,
.param-row select:focus {
  border-color: var(--accent);
}
