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

:root, :root[data-theme="light"] {
  --bg-primary: #f0f2f7;
  --bg-secondary: #e8ebf3;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --bg-input: #f5f7fb;
  --border: #dde1ed;
  --border-subtle: #eaecf4;
  --text-primary: #1a1d2e;
  --text-secondary: #5a6080;
  --text-muted: #9aa0bc;
  --accent: #2563eb;
  --accent-soft: rgba(37,99,235,0.08);
  --profit: #059669;
  --profit-soft: rgba(5,150,105,0.08);
  --loss: #dc2626;
  --loss-soft: rgba(220,38,38,0.08);
  --warning: #d97706;
  --warning-soft: rgba(217,119,6,0.08);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --navbar-height: 64px;
  --sidebar-width: 240px;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

:root[data-theme="dark"] {
  --bg-primary: #0d0f14;
  --bg-secondary: #13161e;
  --bg-card: #1a1e2a;
  --bg-card-hover: #252a3a;
  --bg-input: #0d0f14;
  --border: #2d3348;
  --border-subtle: #1e2235;
  --text-primary: #e8eaf0;
  --text-secondary: #8b91a8;
  --text-muted: #555d78;
  --accent: #4a90e2;
  --accent-soft: rgba(74,144,226,0.12);
  --profit: #26a69a;
  --profit-soft: rgba(38,166,154,0.12);
  --loss: #ef5350;
  --loss-soft: rgba(239,83,80,0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245,158,11,0.12);
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transition: background 0.3s, border 0.3s;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  min-width: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  white-space: nowrap;
}

.logo svg { width: 24px; height: 24px; }

.indices-ticker {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ticker-name { color: var(--text-muted); }
.ticker-value { font-family: var(--font-mono); font-weight: 600; }
.ticker-change { font-size: 0.75rem; font-family: var(--font-mono); }
.ticker-change.up { color: var(--profit); }
.ticker-change.down { color: var(--loss); }
.ticker-sep { color: var(--border); }

.ticker-loading {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  white-space: nowrap;
}
.chip-icon { width: 14px; height: 14px; }
.chip-label { color: var(--text-secondary); font-size: 0.75rem; }
.chip-value { font-weight: 600; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.theme-toggle svg { width: 18px; height: 18px; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 0;
  z-index: 90;
  transition: background 0.3s, border 0.3s;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer { padding: 8px 16px; }
.sidebar-ver { color: var(--text-muted); font-size: 0.75rem; }

/* Mobile Tabs */
.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  transition: background 0.3s, border 0.3s;
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 4px 12px;
  transition: color 0.2s;
}
.mobile-tab.active { color: var(--accent); }
.mobile-tab svg { width: 20px; height: 20px; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  padding: 24px;
  transition: margin 0.3s, background 0.3s;
}

/* Tabs */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease-out; }

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

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s, border 0.3s;
}
.card:hover { transform: translateY(-1px); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.card h3:last-child { margin-bottom: 0; }

/* Wallet Bar */
.wallet-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
  margin-bottom: 20px;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: background 0.3s, border 0.3s;
  position: relative;
  overflow: hidden;
}
.stat-card.accent-profit { border-left: 3px solid var(--profit); }
.stat-card.accent-loss { border-left: 3px solid var(--loss); }
.stat-card.accent-blue { border-left: 3px solid var(--accent); }
.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* Table scroll wrapper — prevents layout break on wide tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll::-webkit-scrollbar { height: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Two Column Grid */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text-primary); }
th .sort-arrow { margin-left: 4px; font-size: 0.6rem; }
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.2s;
  white-space: nowrap;
}
td:first-child, th:first-child { padding-left: 16px; }
td:last-child, th:last-child { padding-right: 16px; text-align: right; }
td.mono { font-family: var(--font-mono); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 4px; }
tr:hover td { background: var(--bg-card-hover); }

.mono { font-family: var(--font-mono); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-buy { background: var(--profit); color: #fff; }
.btn-sell { background: var(--loss); color: #fff; }
.btn-danger { background: var(--loss); color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-danger-outline { background: transparent; color: var(--loss); border: 1px solid var(--loss); }

/* Forms */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s;
}
.input:focus { border-color: var(--accent); }

.input-search {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s;
}
.input-search:focus { border-color: var(--accent); }

.form-row {
  margin-bottom: 14px;
}
.form-row label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.search-wrapper {
  position: relative;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Exchange Toggle */
.exchange-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
}
.exch-btn {
  flex: 1;
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.exch-btn.active { background: var(--accent); color: #fff; }
.exch-btn:hover:not(.active) { color: var(--text-primary); }

/* Pill Toggle */
.pill-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.pill-btn {
  flex: 1;
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.pill-btn.active { background: var(--accent); color: #fff; }

/* Dropdown */
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow);
}
.dropdown.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.dropdown-item:hover, .dropdown-item.highlighted { background: var(--bg-card-hover); }
.dropdown-item .dd-name { font-weight: 500; font-size: 0.85rem; }
.dropdown-item .dd-symbol { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.dropdown-item .dd-right { display: flex; align-items: center; gap: 8px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-nse { background: var(--accent-soft); color: var(--accent); }
.badge-bse { background: var(--warning-soft); color: var(--warning); }
.badge-buy { background: var(--profit-soft); color: var(--profit); }
.badge-sell { background: var(--loss-soft); color: var(--loss); }

/* Price Card */
.price-card {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}
.price-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.price-company { font-weight: 600; font-size: 0.9rem; }
.price-main { display: flex; align-items: baseline; gap: 12px; }
.price-value { font-size: 1.5rem; font-weight: 700; }
.price-change { font-size: 0.85rem; font-family: var(--font-mono); }
.price-change.up { color: var(--profit); }
.price-change.down { color: var(--loss); }

.estimated-total {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding: 10px 0;
}
.estimated-total .mono { color: var(--text-primary); font-weight: 600; font-size: 1rem; }

.trade-buttons { display: flex; gap: 12px; }
.trade-buttons .btn { flex: 1; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-icon { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; font-weight: 500; }
.empty-sub { font-size: 0.8rem; }

/* Collapsible */
.collapsible { padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 16px; }
.hidden { display: none !important; }

/* Last Updated */
.last-updated {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
  padding-top: 8px;
}

/* Watchlist Grid */
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.watchlist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.2s, border 0.2s;
  position: relative;
}
.watchlist-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.watchlist-card .wl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.watchlist-card .wl-company { font-weight: 600; font-size: 0.85rem; }
.watchlist-card .wl-price { font-size: 1.4rem; font-weight: 700; font-family: var(--font-mono); margin-bottom: 4px; }
.watchlist-card .wl-change { font-size: 0.8rem; font-family: var(--font-mono); }
.watchlist-card .wl-change.up { color: var(--profit); }
.watchlist-card .wl-change.down { color: var(--loss); }
.watchlist-card .wl-highlow {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}
.wl-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.wl-remove:hover { color: var(--loss); }

/* Chart */
.chart-wrapper {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 16px;
  aspect-ratio: 1;
}
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}
.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-label { color: var(--text-secondary); }
.legend-value { margin-left: auto; font-family: var(--font-mono); font-weight: 500; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  color: var(--text-primary);
  animation: slideInRight 0.3s ease-out;
  pointer-events: auto;
  max-width: 380px;
}
.toast.success { border-left-color: var(--profit); }
.toast.error { border-left-color: var(--loss); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--accent); }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  padding: 0 4px;
  cursor: pointer;
}
.modal-body { margin-bottom: 20px; color: var(--text-secondary); font-size: 0.9rem; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* Price Flash */
@keyframes priceFlash {
  0% { background: rgba(245,158,11,0.25); }
  100% { background: transparent; }
}
.price-flash { animation: priceFlash 0.8s ease-out; }

/* Skeleton */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 16px;
  margin: 8px 0;
}

/* Verdict Colors + Chips */
.verdict-good { color: var(--profit); font-weight: 600; }
.verdict-early { color: var(--warning); font-weight: 600; }
.verdict-perfect { color: var(--accent); font-weight: 600; }
.verdict-losscut { color: var(--warning); font-weight: 600; }
.verdict-bad { color: var(--loss); font-weight: 600; }
.verdict-neutral { color: var(--text-muted); font-weight: 600; }

/* Market Closed Badge */
.market-closed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--warning-soft);
  color: var(--warning);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-tabs { display: flex; }
  .main-content {
    margin-left: 0;
    height: calc(100vh - var(--navbar-height) - 56px);
    padding: 16px;
    padding-bottom: 8px;
  }
  .two-col-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .wallet-bar {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .wallet-bar .btn { grid-column: 1 / -1; }
  .navbar { padding: 0 12px; }
  .indices-ticker { display: none; }
  .wallet-chip .chip-label { display: none; }
  .watchlist-grid { grid-template-columns: 1fr; }
  .chart-wrapper { max-width: 200px; }
  .exchange-toggle { width: 100%; }
  .trade-buttons { flex-direction: row; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .wallet-bar { grid-template-columns: 1fr; }
  .wallet-bar .btn { grid-column: auto; }
  .stat-value { font-size: 1rem; }
}

.strategy-buttons .btn {
  transition: all 0.2s ease;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.strategy-buttons .btn.active-strategy {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
}

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

/* AI Advisor */
.ai-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#ai-recommendations-table td {
  white-space: nowrap;
}

#ai-recommendations-table td:last-child {
  white-space: normal;
  max-width: 300px;
}

/* Zerodha Connect */
.zerodha-cmd-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.zerodha-cmd-entry:last-child {
  border-bottom: none;
}

.zerodha-cmd-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.zerodha-cmd-prompt {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.zerodha-cmd-text {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.zerodha-cmd-time {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.zerodha-cmd-output {
  padding-left: 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

.zerodha-output-success {
  color: var(--profit);
}

.zerodha-output-error {
  color: var(--loss);
}

.zerodha-output-info {
  color: var(--text-secondary);
}

.zerodha-cmd-loading {
  color: var(--text-muted);
  font-style: italic;
}

.quick-cmd {
  font-family: var(--font-mono) !important;
  font-size: 0.75rem !important;
}

.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.sortable-header:hover {
  background-color: var(--bg-secondary);
}

.sort-indicator {
  font-size: 0.7em;
  color: var(--accent);
  margin-left: 4px;
}

/* ========================================
   MOBILE-FIRST BOT DASHBOARD IMPROVEMENTS
   ======================================== */
@media (max-width: 768px) {
  .bot-summary-grid, .master-session-banner {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .stat-card, .card { padding: 12px !important; }
  .table-responsive, .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 420px; }
  .bot-actions, .button-row { flex-wrap: wrap; gap: 8px; }
  .bot-actions .btn, .button-row .btn {
    flex: 1 1 45%;
    font-size: 0.8rem;
    padding: 8px 10px;
  }
  .nav-tabs, .tab-bar, .mobile-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs .nav-link, .tab-btn {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 8px 12px;
  }
  .text-success, .text-danger { font-size: 1rem; font-weight: 700; }
  #bot-picks-table td, #bot-picks-table th,
  #bot-trades-table td, #bot-trades-table th,
  #bot-squaredoff-table td, #bot-squaredoff-table th {
    padding: 8px 6px;
    font-size: 0.78rem;
  }
  .hide-mobile { display: none !important; }
  .summary-row { flex-direction: column !important; gap: 8px; }
  .summary-row > div, .summary-card { width: 100% !important; min-width: unset !important; }
  .btn { min-height: 40px; }
  h2, h3 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  table { min-width: 340px; font-size: 0.72rem; }
  .stat-value { font-size: 0.9rem !important; }
  .badge { font-size: 0.65rem; padding: 2px 6px; }
  .bot-actions .btn, .button-row .btn { flex: 1 1 100%; }
}
