:root {
  --bg-base: #06090e;
  --bg-surface: #0c121d;
  --bg-glass: rgba(14, 21, 35, 0.75);
  --bg-glass-hover: rgba(22, 33, 54, 0.85);
  --border-glass: rgba(0, 229, 255, 0.12);
  --border-glass-bright: rgba(0, 229, 255, 0.35);
  
  --accent-cyan: #00e5ff;
  --accent-blue: #2979ff;
  --accent-green: #00e676;
  --accent-red: #ff3d71;
  --accent-gold: #ffd600;
  --accent-purple: #d500f9;
  
  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-glow-cyan: 0 0 25px rgba(0, 229, 255, 0.15);
  --shadow-glow-green: 0 0 25px rgba(0, 230, 118, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(0, 229, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(0, 230, 118, 0.04) 0%, transparent 40%);
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==================== HEADER ==================== */
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(0, 230, 118, 0.2));
  border: 1px solid var(--border-glass-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-cyan);
}

.brand-icon {
  width: 26px;
  height: 26px;
  color: var(--accent-cyan);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.accent-text {
  color: var(--accent-cyan);
}

.brand-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
}

.pulse {
  animation: beacon-pulse 2s infinite;
}

@keyframes beacon-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(0, 230, 118, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

.header-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-stat {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 1rem;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ==================== TOGGLE SWITCH ==================== */
.telegram-toggle-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.toggle-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

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

input:checked + .slider:before {
  transform: translateX(18px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* ==================== NAVIGATION TABS ==================== */
.hub-nav {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(10, 15, 25, 0.9);
  border-bottom: 1px solid var(--border-glass);
  overflow-x: auto;
  white-space: nowrap;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--border-glass-bright);
}

.tab-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
}

.pulse-badge {
  background: var(--accent-green);
  color: #000;
  font-weight: 700;
}

/* ==================== MAIN CONTENT & CARDS ==================== */
.hub-main {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.glass-card:hover {
  border-color: var(--border-glass-bright);
}

.card-glow-cyan:hover { box-shadow: var(--shadow-glow-cyan); }
.card-glow-green:hover { box-shadow: var(--shadow-glow-green); }

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

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.metric-giant {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dual-column-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ==================== POSITIONS GRID ==================== */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-toolbar h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

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

.position-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.position-card.long { border-left: 4px solid var(--accent-green); }
.position-card.short { border-left: 4px solid var(--accent-red); }

.pos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-pair {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.pos-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.pos-type-badge.buy, .pos-type-badge.long {
  background: rgba(0, 230, 118, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.pos-type-badge.sell, .pos-type-badge.short {
  background: rgba(255, 61, 113, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255, 61, 113, 0.3);
}

.pos-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  border-radius: var(--radius-sm);
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-item .label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-item .val {
  font-size: 0.9rem;
  font-weight: 600;
}

.pos-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.status-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-chip.locked-win {
  background: rgba(0, 230, 118, 0.2);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.status-chip.breathe {
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--border-glass-bright);
}

/* ==================== NOTIFICATION FEED ==================== */
.feed-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 650px;
  overflow-y: auto;
  padding-right: 6px;
}

.feed-item {
  display: flex;
  gap: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 14px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.feed-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.feed-icon.signal { background: rgba(0, 229, 255, 0.15); }
.feed-icon.entry { background: rgba(41, 121, 255, 0.15); }
.feed-icon.modify { background: rgba(255, 214, 0, 0.15); }
.feed-icon.exit { background: rgba(0, 230, 118, 0.15); }
.feed-icon.shield { background: rgba(213, 0, 249, 0.15); }

.feed-body {
  flex: 1;
}

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

.feed-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.feed-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.feed-msg {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==================== TABLES ==================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==================== UTILITIES ==================== */
.font-mono { font-family: var(--font-mono); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-cyan { color: var(--accent-cyan); }
.text-gold { color: var(--accent-gold); }
.text-muted { color: var(--text-muted); }
.highlight-cyan { color: var(--accent-cyan); text-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
.divider { margin: 0 6px; color: var(--text-muted); }

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-green { background: rgba(0, 230, 118, 0.15); color: var(--accent-green); border: 1px solid rgba(0, 230, 118, 0.3); }
.badge-cyan { background: rgba(0, 229, 255, 0.15); color: var(--accent-cyan); border: 1px solid rgba(0, 229, 255, 0.3); }
.badge-gold { background: rgba(255, 214, 0, 0.15); color: var(--accent-gold); border: 1px solid rgba(255, 214, 0, 0.3); }
.badge-purple { background: rgba(213, 0, 249, 0.15); color: var(--accent-purple); border: 1px solid rgba(213, 0, 249, 0.3); }

.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-glass-bright);
  color: var(--accent-cyan);
}

.btn-outline:hover {
  background: rgba(0, 229, 255, 0.15);
}

.engine-pills-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: 0.2s;
}

.pill.active {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 600;
  border-color: var(--accent-cyan);
}

.hub-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
}

@media (max-width: 900px) {
  .header-metrics { display: none; }
  .dual-column-layout { grid-template-columns: 1fr; }
  .radar-dashboard-grid { grid-template-columns: 1fr; }
  .hub-header { padding: 12px 16px; }
  .hub-main { padding: 16px; }
}

/* ==================== LOGIN OVERLAY & AUTH ==================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 14, 0.88);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.login-overlay.active {
  display: flex;
  opacity: 1;
}

.login-card {
  width: 90%;
  max-width: 440px;
  background: rgba(14, 21, 35, 0.85);
  border: 1px solid var(--border-glass-bright);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.18), 0 20px 40px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  animation: slideUp 0.3s ease-out;
}

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

.login-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 16px 0 6px;
  color: var(--text-primary);
}

.login-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.login-form {
  margin-top: 24px;
  text-align: left;
}

.login-error {
  background: rgba(255, 61, 113, 0.12);
  border: 1px solid var(--accent-red);
  color: #ff809b;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.04);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.form-row-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--accent-cyan);
  width: 16px;
  height: 16px;
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-cyan), #00b0ff);
  color: #06090e;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
}

.login-btn:active {
  transform: translateY(0);
}

.login-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chip-live {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.logout-btn {
  background: rgba(255, 61, 113, 0.12) !important;
  border: 1px solid rgba(255, 61, 113, 0.35) !important;
  color: var(--accent-red) !important;
}

.logout-btn:hover {
  background: rgba(255, 61, 113, 0.25) !important;
  box-shadow: 0 0 15px rgba(255, 61, 113, 0.3) !important;
}

.cred-success {
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.credentials-btn {
  background: rgba(0, 229, 255, 0.1) !important;
  border: 1px solid rgba(0, 229, 255, 0.3) !important;
  color: var(--accent-cyan) !important;
}

.credentials-btn:hover {
  background: rgba(0, 229, 255, 0.2) !important;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.3) !important;
}
