
:root {
  --bg-main: #F4F6F9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --border-color: #E2E8F0;
  --border-card: #CBD5E1;
  --text-main: #0F172A;
  --text-muted: #475569;
  --accent-green: #15803D;
  --accent-green-bg: #DCFCE7;
  --accent-red: #B91C1C;
  --accent-red-bg: #FEE2E2;
  --accent-blue: #1D4ED8;
  --accent-amber: #B45309;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
}

#app-dashboard {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  padding: 8px 14px;
  box-sizing: border-box;
}

.hidden-screen {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  z-index: -99999 !important;
}

.visible-screen {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
}

.visible-flex {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  opacity: 1 !important;
}

/* Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border-color);
  margin-bottom: 10px;
  gap: 10px;
  min-height: 40px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #10B981, #2563EB);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.title-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.title-text p {
  font-size: 0.72rem;
  color: #475569;
  font-weight: 500;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions .badge,
.header-actions .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.badge {
  padding: 4px 9px;
  border-radius: 14px;
  font-size: 0.73rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-paper {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}

.badge-live {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
}

.badge-bullish {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
}

.badge-bearish {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.badge-stale {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
}

.badge-unavailable {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #CBD5E1;
}

.badge-last-price {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-blue);
}

.metric-card.pnl-card::before {
  background: var(--accent-green);
}

.metric-card.pnl-card.negative::before {
  background: var(--accent-red);
}

.metric-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: #64748B;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.2;
}

.metric-sub {
  font-size: 0.68rem;
  color: #64748B;
  font-weight: 500;
  line-height: 1.2;
}

.metric-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.metric-action-btn:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #1E40AF;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.12);
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 2px 0;
  color: #0F172A;
  line-height: 1.2;
}

.metric-value.profit {
  color: var(--accent-green);
}

.metric-value.loss {
  color: var(--accent-red);
}

/* Control Panel */
.control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease-in-out;
}

.btn-primary {
  background-color: #16A34A;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.25);
}

.btn-primary:hover {
  background-color: #15803D;
}

.btn-stop {
  background-color: #DC2626;
  color: #FFFFFF;
}

.btn-stop:hover {
  background-color: #B91C1C;
}

.btn-secondary {
  background-color: #FFFFFF;
  color: #1E293B;
  border: 1.5px solid #CBD5E1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background-color: #F8FAFC;
  border-color: #94A3B8;
}

.btn-danger {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F8FAFC;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1.5px solid #CBD5E1;
}

.slider-container label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
}

.slider-container input[type=range] {
  accent-color: #16A34A;
  cursor: pointer;
}

.slider-value {
  font-weight: 800;
  font-size: 0.95rem;
  color: #15803D;
  min-width: 45px;
}

/* Layout Columns */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.65fr 1.1fr;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }
}

.grid-column {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.panel-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-title span.badge-count {
  background: #E2E8F0;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.scanner-table-wrapper {
  max-height: 440px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.scanner-table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scanner-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.scanner-table-wrapper::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.scanner-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.scanner-table-wrapper th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #F8FAFC;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

th {
  color: #475569;
  font-weight: 700;
  padding: 6px 8px;
  font-size: 0.74rem;
  border-bottom: 1.5px solid var(--border-color);
  position: sticky;
  top: 0;
  background: #F8FAFC;
}

td {
  padding: 7px 8px;
  border-bottom: 1px solid #F1F5F9;
  color: #1E293B;
  font-size: 0.78rem;
}

tr:hover {
  background: var(--bg-card-hover);
}

.score-bar {
  width: 50px;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #16A34A);
}

.type-intraday {
  color: #1D4ED8;
  font-weight: 700;
  font-size: 0.75rem;
}

.type-swing {
  color: #B45309;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Account Cards */
.account-card {
  background: #F8FAFC;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.account-info h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0F172A;
}

.account-info p {
  font-size: 0.78rem;
  color: #475569;
  margin-top: 2px;
}

/* News List */
.news-item {
  padding: 12px 0;
  border-bottom: 1px solid #F1F5F9;
}

.news-item:last-child {
  border-bottom: none;
}

.news-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #64748B;
  margin-bottom: 4px;
}

.news-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1E293B;
  line-height: 1.35;
}

.news-summary {
  font-size: 0.78rem;
  color: #475569;
  margin-top: 4px;
  line-height: 1.4;
}

/* Logs */
.log-stream {
  max-height: 220px;
  overflow-y: auto;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.78rem;
  background: #F8FAFC;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

.log-line {
  padding: 4px 0;
  border-bottom: 1px solid #E2E8F0;
}

.log-time {
  color: #64748B;
  font-weight: 600;
  margin-right: 6px;
}

.log-SUCCESS { color: #15803D; font-weight: 600; }
.log-INFO { color: #1D4ED8; }
.log-WARNING { color: #B45309; }
.log-DANGER { color: #DC2626; font-weight: 700; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  width: 100%;
  max-width: 450px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0F172A;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 5px;
}

.form-group input, .form-group select {
  width: 100%;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  color: #0F172A;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Fullscreen Chart Mode */
.chart-panel.fullscreen-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  background: #FFFFFF !important;
  padding: 16px 24px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  box-shadow: 0 0 50px rgba(0,0,0,0.5) !important;
}

.chart-panel.fullscreen-active #tradingview-chart-wrapper {
  height: calc(100vh - 120px) !important;
}

.chart-panel.fullscreen-active #native-chart-wrapper {
  height: calc(100vh - 160px) !important;
}

/* ============================================================
   Night Lamp Interactive Login Screen (Instagram Viral Style)
   ============================================================ */
#lamp-login-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  width: 100vw;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 9999999;
  background-color: #0d0f16;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.45s ease;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  user-select: none;
}

#lamp-login-screen.lamp-on {
  background-color: #12141f;
  background-image: radial-gradient(circle at 35% 50%, rgba(192, 132, 252, 0.12) 0%, transparent 65%);
}

.lamp-scene-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 70px;
  max-width: 900px;
  width: 90%;
  position: relative;
}

/* The Lamp */
.lamp-wrapper {
  position: relative;
  width: 240px;
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.lamp-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Light Beam Cone */
.light-beam {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.lamp-on .light-beam {
  opacity: 1;
}

/* Lamp Shade Colors */
.lamp-shade-path {
  fill: #2d3039;
  transition: fill 0.35s ease, filter 0.35s ease;
}

.lamp-on .lamp-shade-path {
  fill: #b392cd;
  filter: drop-shadow(0 0 14px rgba(179, 146, 205, 0.65));
}

.lamp-rim {
  fill: #21232a;
  transition: fill 0.35s ease, filter 0.35s ease;
}

.lamp-on .lamp-rim {
  fill: #fffbeb;
  filter: drop-shadow(0 3px 12px rgba(255, 251, 235, 0.9));
}

/* Lamp Faces */
.face-sleeping {
  opacity: 1;
  transition: opacity 0.25s ease;
}

.face-happy {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lamp-on .face-sleeping {
  opacity: 0;
}

.lamp-on .face-happy {
  opacity: 1;
}

/* Pull Cord (Dori - Minimalist Sleek String Switch) */
.lamp-cord-group {
  cursor: pointer;
  transform-origin: 98px 150px;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lamp-cord-group:hover .cord-line {
  stroke: #ffffff;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9));
}

.lamp-cord-group.pulling {
  transform: translateY(28px) !important;
}

.cord-line {
  stroke: #e2e8f0;
  transition: stroke 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* Login Card (Right Side) */
.lamp-login-card {
  width: 360px;
  background: #171923;
  border: 1.5px solid #2d3142;
  border-radius: 20px;
  padding: 36px 30px;
  opacity: 0;
  transform: translateX(35px) scale(0.93);
  pointer-events: none;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lamp-on .lamp-login-card {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  border-color: #a855f7;
  box-shadow: 0 0 35px rgba(168, 85, 247, 0.4), 0 10px 25px rgba(0, 0, 0, 0.6);
}

.lamp-login-card h2 {
  color: #ffffff;
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 22px;
  letter-spacing: -0.01em;
}

.lamp-input-group {
  margin-bottom: 18px;
  text-align: left;
}

.lamp-input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 7px;
}

.lamp-input-group input {
  width: 100%;
  background: #202433;
  border: 1px solid #33394f;
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 0.92rem;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lamp-input-group input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
  background: #252a3d;
}

.lamp-input-group input::placeholder {
  color: #64748b;
  font-size: 0.85rem;
}


.btn-lamp-login {
  width: 100%;
  background: linear-gradient(135deg, #a855f7, #9333ea);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 12px 0;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.4);
}

.btn-lamp-login:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 24px rgba(168, 85, 247, 0.6);
  transform: translateY(-1px);
}

.btn-lamp-login:active {
  transform: translateY(1px);
}

.lamp-login-error {
  display: none;
  background: rgba(220, 38, 38, 0.25);
  border: 1.5px solid #ef4444;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fecaca;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.4;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

@keyframes shakeCard {
  0%, 100% { transform: translateX(0) scale(1); }
  15% { transform: translateX(-14px) scale(1); }
  30% { transform: translateX(14px) scale(1); }
  45% { transform: translateX(-10px) scale(1); }
  60% { transform: translateX(10px) scale(1); }
  75% { transform: translateX(-5px) scale(1); }
  90% { transform: translateX(5px) scale(1); }
}

.lamp-login-card.shake-error {
  animation: shakeCard 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: #ef4444 !important;
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.7), 0 10px 30px rgba(0, 0, 0, 0.9) !important;
}

#forgot-password-modal {
  user-select: text !important;
  pointer-events: auto !important;
}

#forgot-password-modal .modal {
  pointer-events: auto !important;
}

/* Enhanced Mobile Responsiveness (100% Screen Fit - Zero Horizontal Slide) */
@media (max-width: 768px) {
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  #app-dashboard {
    padding: 6px 8px 24px !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  #lamp-login-screen {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 10px !important;
    box-sizing: border-box !important;
    z-index: 9999999;
  }

  #lamp-login-screen.hidden-screen {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    z-index: -99999 !important;
  }

  .lamp-scene-container {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: auto !important;
    width: 100% !important;
    max-width: 340px !important;
    box-sizing: border-box !important;
  }

  .lamp-wrapper {
    height: 230px !important;
    width: 190px !important;
    margin: 0 auto !important;
    transform: scale(0.88) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    cursor: pointer !important;
  }

  .pull-cord-hint {
    top: 220px !important;
    left: 10px !important;
    font-size: 0.72rem !important;
    padding: 3px 8px !important;
  }

  .lamp-login-card {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    opacity: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    transform: translateY(16px) scale(0.95) !important;
    pointer-events: none !important;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
    border-color: #a855f7 !important;
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.35), 0 8px 20px rgba(0, 0, 0, 0.7) !important;
    box-sizing: border-box !important;
  }

  .lamp-on .lamp-login-card {
    opacity: 1 !important;
    max-height: 550px !important;
    padding: 18px 14px !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
    margin-top: 4px !important;
    overflow: visible !important;
  }

  .top-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding: 4px 2px 6px !important;
    margin-bottom: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .logo-area {
    width: 100% !important;
  }

  .title-text h1 {
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
    word-break: break-word !important;
  }

  .title-text p {
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
  }

  .header-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 4px !important;
  }

  .header-actions .btn, .header-actions .badge {
    font-size: 0.68rem !important;
    padding: 3px 6px !important;
  }

  #market-notice-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .indian-market-ribbon {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 5px 8px !important;
    margin-bottom: 8px !important;
    box-sizing: border-box !important;
  }

  .index-pill {
    flex-shrink: 0 !important;
    padding: 3px 8px !important;
    font-size: 0.72rem !important;
  }

  .pnl-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding: 6px 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .timeframe-filters {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
    padding-bottom: 3px !important;
  }

  .timeframe-filters .btn {
    flex-shrink: 0 !important;
    padding: 2px 7px !important;
    font-size: 0.68rem !important;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 8px !important;
  }

  .metric-card {
    padding: 6px 8px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .metric-card .metric-label {
    font-size: 0.62rem !important;
  }

  .metric-card .metric-value {
    font-size: 1.1rem !important;
    margin: 1px 0 !important;
  }

  .metric-card .metric-sub {
    font-size: 0.62rem !important;
  }

  .scalper-panel {
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
  }

  .scalp-action-wrapper {
    gap: 8px !important;
    margin-top: 4px !important;
  }

  .btn-scalp-action {
    flex: 1 1 calc(50% - 4px) !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 5px 6px !important;
  }

  .btn-scalp-title {
    font-size: 0.74rem !important;
  }

  .btn-scalp-sub {
    font-size: 0.60rem !important;
  }

  .control-panel {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .control-group {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .control-group .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 5px 10px !important;
  }

  .slider-container {
    width: 100% !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    padding: 4px 8px !important;
  }

  .chart-panel {
    padding: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .chart-quick-symbols {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    width: 100% !important;
  }

  .chart-quick-symbols .btn {
    flex-shrink: 0 !important;
    padding: 3px 6px !important;
    font-size: 0.7rem !important;
  }

  .chart-controls-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .chart-controls-toolbar > div {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 3px !important;
    width: 100% !important;
  }

  .chart-controls-toolbar .btn {
    flex-shrink: 0 !important;
    padding: 3px 6px !important;
    font-size: 0.68rem !important;
  }

  #native-chart-wrapper {
    height: 250px !important;
    width: 100% !important;
  }

  .dashboard-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px !important;
    min-width: 0 !important;
    margin-bottom: 8px !important;
  }

  .grid-column {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .panel-header {
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding-bottom: 6px !important;
    margin-bottom: 8px !important;
  }

  .panel-title {
    font-size: 0.85rem !important;
  }

  .index-explorer-panel {
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
  }

  .index-cat-tabs {
    gap: 4px !important;
    padding-bottom: 4px !important;
    margin-bottom: 6px !important;
  }

  .cat-tab-btn {
    padding: 3px 7px !important;
    font-size: 0.68rem !important;
  }

  .index-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 5px !important;
    max-height: 200px !important;
  }

  .index-card {
    padding: 5px 6px !important;
  }

  .index-card-title {
    font-size: 0.72rem !important;
  }

  .index-card-subtitle {
    font-size: 0.6rem !important;
  }

  .index-card-price {
    font-size: 0.8rem !important;
  }

  .table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    box-sizing: border-box !important;
  }

  table {
    min-width: 520px !important;
    width: 100% !important;
    font-size: 0.74rem !important;
  }

  th {
    padding: 5px 6px !important;
    font-size: 0.7rem !important;
  }

  td {
    padding: 5px 6px !important;
    font-size: 0.72rem !important;
  }

  .modal {
    max-width: 95vw !important;
    padding: 14px 12px !important;
  }
}

/* ==========================================================================
   5-Category Index & F&O Market Watch Explorer
   ========================================================================== */
.index-explorer-panel {
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.index-cat-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 5px;
  margin-bottom: 8px;
  border-bottom: 1.5px solid #E2E8F0;
}

.cat-tab-btn {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cat-tab-btn:hover {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1D4ED8;
}

.cat-tab-btn.active {
  background: #2563EB;
  border-color: #1D4ED8;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.index-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.index-card:hover {
  background: #FFFFFF;
  border-color: #2563EB;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.index-card.selected {
  border-color: #2563EB;
  background: #EFF6FF;
}

.index-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2px;
}

.index-card-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.2;
}

.index-card-subtitle {
  font-size: 0.63rem;
  color: #64748B;
  margin-top: 1px;
}

.index-card-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 4px;
}

.index-card-price {
  font-size: 0.84rem;
  font-weight: 800;
  color: #0F172A;
}

.index-card-chg {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.index-card-chg.pos {
  background: #DCFCE7;
  color: #15803D;
}

.index-card-chg.neg {
  background: #FEE2E2;
  color: #B91C1C;
}

.index-card-chg.neu {
  background: #F1F5F9;
  color: #64748B;
}


/* Direction Badges for Active Trades */
.badge-dir-long {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-dir-short {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.points-gain {
  color: #16A34A;
  font-weight: 700;
  font-size: 0.82rem;
}

.points-loss {
  color: #DC2626;
  font-weight: 700;
  font-size: 0.82rem;
}

/* Spin animation for manual refresh */
@keyframes spin-anim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinning-icon {
  display: inline-block;
  animation: spin-anim 0.7s linear infinite;
}

/* Zero-flicker instant login state preservation on page reload */
html.user-logged-in #lamp-login-screen {
  display: none !important;
  visibility: hidden !important;
}

html.user-logged-in #app-dashboard {
  display: block !important;
  visibility: visible !important;
}

/* Option Chain Pro Styling */
.opt-cell-itm {
  background-color: #FEFCE8 !important;
}
.opt-row-atm {
  background-color: #FEF08A !important;
  border-top: 2.5px solid #CA8A04 !important;
  border-bottom: 2.5px solid #CA8A04 !important;
  font-weight: bold;
}
.opt-row-atm td {
  background-color: #FEF9C3 !important;
  border-top: 2px solid #CA8A04 !important;
  border-bottom: 2px solid #CA8A04 !important;
  color: #713F12 !important;
  font-weight: 800;
}
.opt-row-atm:hover td {
  background-color: #FEF08A !important;
}
@keyframes pulse-atm-glow {
  0% { box-shadow: inset 0 0 0 0 rgba(202, 138, 4, 0.7); }
  50% { box-shadow: inset 0 0 14px 3px rgba(202, 138, 4, 0.5); }
  100% { box-shadow: inset 0 0 0 0 rgba(202, 138, 4, 0); }
}
.pulse-atm td {
  animation: pulse-atm-glow 1s ease-in-out 3;
}
.opt-table th {
  padding: 8px 10px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.opt-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #E2E8F0;
}
.opt-table tr:hover {
  background-color: #F8FAFC;
}

/* Scalper Console Pulse Animations for 2-Way Sync */
@keyframes scalper-pulse-green {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@keyframes scalper-pulse-red {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.pulse-green {
  animation: scalper-pulse-green 0.7s ease-in-out 2 !important;
  border: 2px solid #15803D !important;
}

.pulse-red {
  animation: scalper-pulse-red 0.7s ease-in-out 2 !important;
  border: 2px solid #B91C1C !important;
}

/* Pro Scalper Compact Execution Buttons */
.scalp-action-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 6px auto 0 auto;
  width: 100%;
}

.btn-scalp-action {
  flex: 0 1 250px;
  max-width: 270px;
  min-width: 190px;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-scalp-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.btn-scalp-action:active {
  transform: translateY(1px);
}

.btn-scalp-ce {
  background: #16A34A !important;
  color: #FFFFFF !important;
}

.btn-scalp-pe {
  background: #DC2626 !important;
  color: #FFFFFF !important;
}

.btn-scalp-title {
  font-size: 0.80rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-scalp-sub {
  font-size: 0.65rem;
  font-weight: 600;
  opacity: 0.94;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}


