:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #0d904f;
  --danger: #d93025;
  --warning: #f29900;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
  --radius: 8px;
  --transition: 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Header ─── */
.header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

/* Environment badge */
.env-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 6px;
}
.env-badge.env-prod {
  background: #e53935;
  color: #fff;
}
.env-badge.env-dev {
  background: #ffc107;
  color: #333;
}

/* Holiday banner */
.holiday-banner {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  color: #e65100;
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid #ffcc80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.active-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  max-width: 280px;
}

.active-user-badge #activeUserName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-user-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
}

.active-user-badge .dot.inactive {
  background: #ff9800;
}

/* ─── Navigation Tabs ─── */
.nav-tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab:hover { color: var(--primary); }
.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── Main Content ─── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.view { display: none; }
.view.active { display: block; }

/* ─── Cards ─── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 16px;
}

/* ─── User Cards ─── */
.user-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  transition: var(--transition);
}

.user-card:hover {
  box-shadow: var(--shadow-lg);
}

.user-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.session-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.session-badge.active {
  background: #e6f4ea;
  color: var(--success);
}

.session-badge.inactive {
  background: #fef7e0;
  color: var(--warning);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #0a7a43; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b71c1c; }

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 18px;
}

.btn-icon:hover { background: #f1f3f4; }

.btn:disabled, .btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 14px;
}

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

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: var(--transition);
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.modal-header h2 {
  font-size: 17px;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: white;
}

/* ─── Audit Table ─── */
.audit-list {
  width: 100%;
}

.audit-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-item:last-child { border-bottom: none; }

.audit-action {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
  width: fit-content;
}

.audit-action.CREATE { background: #e6f4ea; color: var(--success); }
.audit-action.UPDATE { background: #e8f0fe; color: var(--primary); }
.audit-action.DELETE { background: #fce8e6; color: var(--danger); }
.audit-action.LOGIN_STARTED { background: #fef7e0; color: var(--warning); }
.audit-action.LOGIN { background: #e6f4ea; color: var(--success); }
.audit-action.LOGIN_FAILED { background: #fce8e6; color: var(--danger); }

.audit-desc {
  font-size: 14px;
  color: var(--text);
}

.audit-details {
  font-size: 12px;
  color: var(--text-secondary);
}

.audit-time {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ─── Loading / Status ─── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 300;
}

.loading-overlay.active { display: flex; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 280px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  z-index: 400;
  animation: fadeInUp 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

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

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--text);
}

/* ─── Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
}

.pagination button {
  padding: 6px 12px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Filters ─── */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
}

/* ─── Toolbar ─── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.toolbar h2 {
  font-size: 18px;
  font-weight: 600;
}

/* ─── User Switcher ─── */
.user-switcher {
  position: relative;
}

.user-switcher-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  z-index: 150;
  display: none;
  overflow: hidden;
}

.user-switcher-dropdown.active { display: block; }

.user-switcher-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.user-switcher-item:last-child { border-bottom: none; }
.user-switcher-item:hover { background: #f1f3f4; }
.user-switcher-item.selected { background: #e8f0fe; }

/* ─── Login Screen ─── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-width: 400px;
  width: 100%;
}

.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }

.google-btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-error {
  margin-top: 16px;
  padding: 10px 16px;
  background: #fce8e6;
  color: var(--danger);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ─── Header User Menu ─── */
.header-user-menu {
  position: relative;
  cursor: pointer;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  transition: border-color var(--transition);
}
.header-avatar:hover { border-color: white; }

.header-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 16px;
  z-index: 200;
  color: var(--text);
}

.header-dropdown.active { display: block; }
.header-dropdown-name { font-weight: 600; font-size: 14px; }
.header-dropdown-email { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.header-dropdown-role { font-size: 12px; margin-top: 4px; }

/* ─── Responsive ─── */
@media (min-width: 768px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--radius); }
  .main { padding: 24px; }
  .header { padding: 14px 24px; }
  .header h1 { font-size: 20px; }
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
  .user-actions { flex-direction: column; }
  .btn-sm { padding: 6px 8px; font-size: 11px; }
  .login-card { padding: 32px 24px; }
}

/* ─── Portfolio Grid ─── */
.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 2fr 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 180px);
  min-height: 600px;
}

/* Fut-Open Positions spans 2 rows (right column) */
#section-fnoopen {
  grid-column: 2;
  grid-row: 1 / 3;
}

#section-fnoopen.expanded {
  grid-column: 1 / -1 !important;
  grid-row: 1 / -1 !important;
}

.portfolio-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.portfolio-grid.has-expanded .portfolio-section:not(.expanded) {
  display: none;
}

.portfolio-grid.has-expanded .portfolio-section.expanded {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e8eaed 100%);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.section-header:hover {
  background: linear-gradient(135deg, #e8eaed 0%, #dadce0 100%);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.section-icon {
  font-size: 16px;
}

.section-count {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-secondary);
}

.section-pnl {
  font-weight: 700;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

.section-pnl.positive {
  color: var(--success);
  background: #e6f4ea;
}

.section-pnl.negative {
  color: var(--danger);
  background: #fce8e6;
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fno-filter-select {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.fno-filter-select:hover {
  border-color: var(--primary);
}
.fno-filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66,133,244,0.15);
}

.section-expand-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  border-radius: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-expand-btn:hover {
  background: rgba(0,0,0,0.08);
  color: var(--primary);
}

.portfolio-section.expanded .section-expand-btn::after {
  content: '';
}

.section-body {
  flex: 1;
  overflow: auto;
  position: relative;
}

.section-body .data-table-wrap {
  overflow: visible;
}

.section-content {
  min-height: 100%;
}

/* Funds & Margins grid */
.funds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.funds-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.funds-label {
  color: var(--text-secondary);
  font-size: 12px;
}
.funds-value {
  font-weight: 600;
  font-size: 13px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.section-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
  color: var(--text-secondary);
  font-size: 13px;
}

.section-error {
  padding: 12px;
  color: var(--danger);
  font-size: 13px;
  background: #fce8e6;
  border-radius: 4px;
  margin: 8px;
}

/* ─── Data Tables ─── */
.data-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  background: #f1f3f4;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  position: relative;
}

.data-table th:hover {
  background: #e4e6e8;
}

.data-table th .sort-arrow {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.4;
}

.data-table th.sort-asc .sort-arrow,
.data-table th.sort-desc .sort-arrow {
  opacity: 1;
  color: var(--primary);
}

.data-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #f1f3f4;
  color: var(--text);
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

.data-table th.num {
  text-align: right;
}

.stock-name {
  font-weight: 600;
  color: var(--primary);
}

.positive { color: var(--success) !important; }
.negative { color: var(--danger) !important; }

.nowrap { white-space: nowrap; }

.row-zero {
  opacity: 0.4;
}

/* Tags for product types */
.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag-futures { background: #e8f0fe; color: #1967d2; }
.tag-options { background: #fef7e0; color: #ea8600; }
.tag-cash { background: #e6f4ea; color: #137333; }

/* Trade action badges */
.trade-action {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.action-buy { background: #e6f4ea; color: #137333; }
.action-sell { background: #fce8e6; color: #c5221f; }

.order-id {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ─── Portfolio Responsive ─── */
@media (max-width: 768px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    height: auto;
    min-height: auto;
  }

  #section-fnoopen {
    grid-column: 1;
    grid-row: auto;
  }

  .portfolio-section {
    max-height: 300px;
  }

  .portfolio-section.expanded {
    max-height: none;
    min-height: 70vh;
  }

  .portfolio-grid.has-expanded .portfolio-section:not(.expanded) {
    display: none;
  }

  .data-table {
    font-size: 11px;
  }

  .data-table th, .data-table td {
    padding: 4px 6px;
  }

  .section-header {
    padding: 8px 10px;
  }

  .section-title {
    font-size: 12px;
  }
}

/* ─── Rollover Console ─── */
.rollover-console-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.rollover-console-toggle:hover { transform: scale(1.1); }

.rollover-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.rollover-console {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #1e1e2e;
  color: #cdd6f4;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  transition: right 0.3s ease;
}
.rollover-console.open {
  right: 0;
}

.rollover-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #181825;
  border-bottom: 1px solid #313244;
  flex-shrink: 0;
}
.rollover-console-title {
  font-weight: 600;
  font-size: 14px;
  color: #cdd6f4;
}
.rollover-console-header .btn-icon {
  color: #cdd6f4;
  background: transparent;
}
.rollover-clear-btn { font-size: 14px !important; }

.rollover-console-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.6;
}
.rollover-console-body::-webkit-scrollbar { width: 6px; }
.rollover-console-body::-webkit-scrollbar-track { background: #181825; }
.rollover-console-body::-webkit-scrollbar-thumb { background: #45475a; border-radius: 3px; }

.rollover-empty {
  color: #585b70;
  text-align: center;
  padding: 40px 20px;
  font-style: italic;
}

.roll-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(69,71,90,0.3);
  animation: rollFadeIn 0.3s ease;
}
@keyframes rollFadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.roll-time { color: #585b70; font-size: 11px; margin-right: 6px; }
.roll-msg-info { color: #89b4fa; }
.roll-msg-success { color: #a6e3a1; }
.roll-msg-error { color: #f38ba8; }
.roll-msg-warn { color: #fab387; }
.roll-msg-order { color: #cba6f7; }
.roll-msg-wait { color: #585b70; }
.roll-msg-lot_start { color: #f9e2af; font-weight: 600; margin-top: 6px; }
.roll-msg-done { color: #94e2d5; font-weight: 600; border-top: 1px solid #313244; padding-top: 6px; margin-top: 6px; }

.roll-separator {
  border: none;
  border-top: 1px dashed #313244;
  margin: 8px 0;
}

/* Rollover button in table */
.btn-rollover {
  background: #e8f0fe;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-rollover:hover {
  background: var(--primary);
  color: white;
}
.btn-rollover:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-rollover.rolling {
  background: #fef7e0;
  color: #b06000;
  border-color: #b06000;
}
.btn-rollover.rolling:hover {
  background: #b06000;
  color: white;
}
.btn-rollover.done {
  background: #e6f4ea;
  color: #0d904f;
  border-color: #0d904f;
  cursor: default;
}
.btn-rollover.failed {
  background: #fce8e6;
  color: #d93025;
  border-color: #d93025;
  cursor: default;
}

/* Equity Buy/Sell header buttons */
.btn-equity-order {
  background: #0d9f16;
  color: white;
  border: 1px solid #0d9f16;
  border-radius: 4px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-equity-order:hover {
  background: #0b8613;
}
.btn-equity-order.sell {
  background: #d93025;
  border-color: #d93025;
}
.btn-equity-order.sell:hover {
  background: #b3261e;
}

/* Danger button variant for modals */
.btn-danger {
  background: #d93025 !important;
  color: white !important;
  border: 1px solid #d93025 !important;
}
.btn-danger:hover {
  background: #b3261e !important;
}

/* Equity Order Modal — two-column layout */
.eq-order-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .eq-order-layout { grid-template-columns: 1fr; }
}
.eq-order-form { min-width: 0; }
.form-hint { display:block; font-size:13px; color:var(--text-secondary); margin-top:2px; font-style:italic; }
.eq-order-depth {
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}
@media (max-width: 600px) {
  .eq-order-depth { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px; }
}

/* Depth header / LTP */
.depth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.depth-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.depth-ltp {
  font-weight: 700;
  font-size: 13px;
  font-family: 'SF Mono', 'Consolas', monospace;
  transition: color 0.2s;
}
.depth-ltp.positive { color: #0d9f16; }
.depth-ltp.negative { color: #d93025; }
.depth-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-family: 'SF Mono', 'Consolas', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Depth table */
.depth-table-wrap {
  max-height: 260px;
  overflow-y: auto;
}
.depth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
}
.depth-table th {
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.depth-table td {
  padding: 3px 6px;
  text-align: right;
  position: relative;
}
.depth-table td.num { font-variant-numeric: tabular-nums; }
.depth-empty {
  text-align: center !important;
  color: var(--text-secondary);
  font-style: italic;
  padding: 20px 6px !important;
}
.bid-price { color: #0d9f16; font-weight: 600; }
.ask-price { color: #d93025; font-weight: 600; }

/* Depth bar visualization */
.depth-bar {
  position: absolute;
  top: 1px;
  bottom: 1px;
  opacity: 0.15;
  border-radius: 2px;
  z-index: 0;
}
.bid-col .depth-bar { right: 0; background: #0d9f16; }
.ask-col .depth-bar { left: 0; background: #d93025; }
.depth-val { position: relative; z-index: 1; }
.depth-total-row { border-top: 1.5px solid var(--border); }

/* Roll All button in section header */
.btn-roll-all {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-roll-all:hover {
  background: #1558b0;
}
.btn-roll-all.stopping {
  background: #d93025;
  border-color: #d93025;
}
.btn-roll-all.stopping:hover {
  background: #b3261e;
}

/* Stop All button in console header */
.btn-stop-all {
  background: #d93025;
  color: white;
  border: 1px solid #d93025;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-stop-all:hover {
  background: #b3261e;
}

@media (max-width: 768px) {
  .rollover-console {
    width: 100vw;
    right: -100vw;
  }
}

/* ─── Transaction Log Table ─── */
.txn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.txn-table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.txn-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.txn-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}
.txn-time {
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
}
.txn-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.txn-buy {
  background: #e8f5e9;
  color: #2e7d32;
}
.txn-sell {
  background: #fce4ec;
  color: #c62828;
}
.txn-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.txn-status-success {
  background: #e8f5e9;
  color: #2e7d32;
}
.txn-status-failed {
  background: #fce4ec;
  color: #c62828;
}
.txn-status-pending {
  background: #fff8e1;
  color: #f57f17;
}
.txn-qty {
  text-align: right;
  font-weight: 600;
}
.txn-price {
  text-align: right;
  font-family: monospace;
}
.txn-expiry {
  font-size: 11px;
  color: var(--text-secondary);
}
.txn-context {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: #e3f2fd;
  color: #1565c0;
}
.txn-remark {
  font-size: 11px;
  color: var(--text-secondary);
}
.txn-error {
  cursor: help;
}

/* Filter bar enhancements for txn */
.filter-bar input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}

/* ─── Rollover Log ─── */
.rl-session-row {
  cursor: pointer;
  transition: background 0.15s;
}
.rl-session-row:hover {
  background: rgba(33, 150, 243, 0.06) !important;
}
.rl-lots {
  font-family: monospace;
  font-size: 12px;
  white-space: nowrap;
}
.rl-failed {
  background: #fce4ec;
  color: #c62828;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}
.rl-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.rl-status-completed { background: #e8f5e9; color: #2e7d32; }
.rl-status-partial   { background: #fff8e1; color: #f57f17; }
.rl-status-cancelled { background: #fce4ec; color: #c62828; }
.rl-status-error     { background: #fce4ec; color: #c62828; }
.rl-status-aborted   { background: #f3e5f5; color: #7b1fa2; }
.rl-status-running   { background: #e3f2fd; color: #1565c0; }

/* Event detail panel */
.rl-event-panel {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}
.rl-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.rl-event-header h3 {
  margin: 0;
  font-size: 14px;
}
.rl-event-body {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  background: #1e1e2e;
  color: #cdd6f4;
}
.rl-event {
  padding: 2px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}
.rl-event:hover {
  background: rgba(255,255,255,0.04);
}
.rl-ev-time {
  color: #6c7086;
  margin-right: 8px;
  font-size: 11px;
}
.rl-ev-type {
  display: inline-block;
  min-width: 60px;
  padding: 0 4px;
  margin-right: 6px;
  border-radius: 3px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
}
/* Event type colors (dark console theme) */
.rl-ev-init .rl-ev-type    { background: #313244; color: #89b4fa; }
.rl-ev-info .rl-ev-type    { background: #313244; color: #a6e3a1; }
.rl-ev-warn .rl-ev-type    { background: #45392a; color: #f9e2af; }
.rl-ev-error .rl-ev-type   { background: #3b2032; color: #f38ba8; }
.rl-ev-order .rl-ev-type   { background: #1e3a4d; color: #89dceb; }
.rl-ev-success .rl-ev-type { background: #1e3a28; color: #a6e3a1; }
.rl-ev-done .rl-ev-type    { background: #313244; color: #cba6f7; }
.rl-ev-lot_start .rl-ev-type { background: #313244; color: #fab387; }
.rl-ev-wait .rl-ev-type    { background: #313244; color: #6c7086; }
.rl-ev-refresh .rl-ev-type { background: #313244; color: #6c7086; }
/* Message colors per type */
.rl-ev-error .rl-ev-msg  { color: #f38ba8; }
.rl-ev-warn .rl-ev-msg   { color: #f9e2af; }
.rl-ev-success .rl-ev-msg{ color: #a6e3a1; }
.rl-ev-done .rl-ev-msg   { color: #cba6f7; font-weight: 600; }
.rl-ev-wait .rl-ev-msg   { color: #6c7086; }