@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg-darker: #12162c;
  --bg-dashboard: #1a1f3c;
  --bg-card: rgba(32, 40, 78, 0.75);
  --bg-card-hover: rgba(42, 52, 98, 0.85);
  --bg-header: rgba(25, 31, 60, 0.95);
  --bg-input: #1f254b;
  
  --border-glow: rgba(59, 130, 246, 0.15);
  --border-light: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(59, 130, 246, 0.5);

  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  
  --color-accent: #3b82f6;
  --color-accent-glow: rgba(59, 130, 246, 0.25);
  --color-accent-hover: #60a5fa;
  
  --color-up: #10b981;
  --color-up-glow: rgba(16, 185, 129, 0.2);
  --color-up-bg: rgba(16, 185, 129, 0.08);

  --color-down: #ef4444;
  --color-down-glow: rgba(239, 68, 68, 0.2);
  --color-down-bg: rgba(239, 68, 68, 0.08);

  --color-warn: #f59e0b;
  --color-warn-bg: rgba(245, 158, 11, 0.08);

  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  
  --box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  zoom: 0.9;
  background-color: var(--bg-darker);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  height: calc(100vh / 0.9);
  min-height: calc(100vh / 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 12px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
}

.auth-hidden {
  display: none !important;
}

.auth-screen {
  width: 100%;
  height: 100%;
  max-width: 1100px;
  background: var(--bg-dashboard);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.auth-shell {
  width: 100%;
  max-width: 880px;
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--color-up);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.auth-brand h2 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0;
}

.auth-brand p {
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.auth-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 20px;
}

.auth-panel h3 {
  font-size: 0.95rem;
  color: var(--color-text-primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.75px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-auth-panel .btn {
  width: 100%;
}

.admin-screen {
  width: 100%;
  height: 100%;
  max-width: 1600px;
  background: var(--bg-dashboard);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
  padding: 22px;
  overflow: hidden;
}

.admin-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

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

.admin-header h2 {
  font-size: 1.6rem;
  letter-spacing: 0;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
}

.admin-summary span {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.admin-summary strong {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  color: var(--color-text-primary);
}

.admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.admin-users-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  overflow: auto;
}

.admin-panel-title {
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  color: var(--color-text-secondary);
  display: flex;
  font-size: 0.72rem;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0.75px;
  padding: 12px 14px;
  text-transform: uppercase;
}

.admin-panel-title .btn {
  font-size: 0.68rem;
  padding: 6px 10px;
  text-transform: none;
}

.admin-add-user {
  border-bottom: 1px solid var(--border-light);
  padding: 14px;
}

.admin-add-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr 1fr 1fr;
  gap: 10px;
}

.admin-add-grid .form-group {
  margin-bottom: 0;
}

.admin-add-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.admin-add-actions .btn {
  min-width: 110px;
}

.admin-users-panel table {
  width: 100%;
  border-collapse: collapse;
}

.admin-users-panel th,
.admin-users-panel td {
  border-bottom: 1px solid var(--border-light);
  padding: 11px 14px;
  font-size: 0.8rem;
}

.admin-users-panel th {
  color: var(--color-text-muted);
  font-size: 0.7rem;
  text-align: left;
  text-transform: uppercase;
}

.admin-users-panel td {
  color: var(--color-text-secondary);
}

.admin-users-panel th:last-child,
.admin-users-panel td:last-child {
  white-space: nowrap;
}

.admin-user-row {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.admin-user-row:hover,
.admin-user-row.selected {
  background: rgba(59, 130, 246, 0.08);
}

.admin-user-row.selected td:first-child {
  border-left: 3px solid var(--color-accent);
}

.admin-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.admin-empty-state {
  align-items: center;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  min-height: 360px;
  text-align: center;
}

.admin-empty-state span {
  color: var(--color-text-primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-empty-state p {
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 260px;
}

.admin-editor-heading {
  align-items: flex-start;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.admin-editor-heading h3 {
  font-size: 1.1rem;
  letter-spacing: 0;
}

.admin-editor-heading p {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  margin-top: 3px;
}

.admin-status-pill {
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 8px;
  text-transform: uppercase;
}

.admin-status-pill.active {
  color: var(--color-up);
}

.admin-status-pill.suspended {
  color: var(--color-down);
}

.admin-editor-grid {
  display: grid;
  gap: 12px;
}

.admin-usage-meter {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  margin: 4px 0 16px;
  padding: 12px;
}

.admin-usage-meter div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.admin-usage-meter span {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.admin-usage-meter strong {
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.usage-track {
  background: var(--bg-darker);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.usage-track span {
  background: var(--color-accent);
  display: block;
  height: 100%;
}

.admin-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-editor-actions .btn {
  min-height: 36px;
}

.auth-user-pill {
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  padding: 4px 8px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  padding: 4px 8px;
}

.logout-btn:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-secondary);
}

/* Master Window Frame */
.window-frame {
  width: 100%;
  height: 100%;
  max-width: 1600px;
  background: var(--bg-dashboard);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

/* Header/Title Bar */
.title-bar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-bar h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-bar h1::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.control-dot:hover {
  transform: scale(1.1);
}

.control-dot.close { background-color: #ff5f56; }
.control-dot.minimize { background-color: #ffbd2e; }
.control-dot.maximize { background-color: #27c93f; }

/* Grid Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 3.2fr 1fr 1.3fr;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 12px;
  flex-grow: 1;
  min-height: 0;
  overflow: hidden;
}

/* Top Section (Merged into columns using individual styling) */
.dashboard-top-section {
  grid-column: span 3;
  display: grid;
  grid-template-columns: 1fr 1.1fr 1.1fr;
  gap: 12px;
}

/* Base Panel Styling */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.panel:hover {
  border-color: rgba(59, 130, 246, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.panel-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Buttons */


  .btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-light);
    color: var(--color-text-primary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-text-secondary);
  }

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 0 12px var(--color-accent-glow);
}

.btn-success {
  background: var(--color-up-bg);
  border-color: var(--color-up);
  color: var(--color-up);
}

.btn-success:hover {
  background: var(--color-up);
  color: #fff;
  box-shadow: 0 0 12px var(--color-up-glow);
}

.btn-danger {
  background: var(--color-down-bg);
  border-color: var(--color-down);
  color: var(--color-down);
}

.btn-danger:hover {
  background: var(--color-down);
  color: #fff;
  box-shadow: 0 0 12px var(--color-down-glow);
}

.btn-warn {
  background: var(--color-warn-bg);
  border-color: var(--color-warn);
  color: var(--color-warn);
}

.btn-warn:hover {
  background: var(--color-warn);
  color: var(--bg-darker);
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* TOP PANELS */
/* 1. Connection Panel */
.connect-panel .button-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.connect-panel .api-log {
  flex-grow: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #38bdf8;
  height: 34px;
  overflow-y: auto;
  line-height: 1.4;
}

/* 2. Algo Select / Actions Panel */
.actions-panel .button-row-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  margin-bottom: 7px;
}

.actions-panel .load-btn {
  width: 100%;
  margin-bottom: 7px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.actions-panel .search-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* 3. Uptime & Reports Panel */
.uptime-panel .stats-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.uptime-panel .stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 6px 10px;
  font-size: 0.75rem;
}

.uptime-panel .stat-box span {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.uptime-panel .stat-box p {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
}

.uptime-panel .reports-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.uptime-panel .exports-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* MAIN CENTRAL AREA - LEFT SIGNAL TABLES */
.signals-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

.signal-table-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.signal-table-panel .panel-title span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
}

.table-wrapper {
  overflow-x: auto;
  flex-grow: 1;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
}

thead {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-light);
}

th {
  padding: 5px 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 5px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

/* Monospace alignment for numbers */
.num-cell {
  font-family: var(--font-mono);
}

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

/* Checkbox design */
.checkbox-container {
  display: block;
  position: relative;
  cursor: pointer;
  font-size: 18px;
  user-select: none;
  width: 18px;
  height: 18px;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--bg-input);
  border: 1px solid var(--color-text-muted);
  border-radius: 3px;
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--color-text-secondary);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Strength indicators */
.strength-bar {
  width: 60px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.strength-fill {
  height: 100%;
  border-radius: 3px;
}

.strength-fill.strong-buy { background-color: var(--color-up); width: 95%; }
.strength-fill.buy { background-color: #34d399; width: 70%; }
.strength-fill.strong-sell { background-color: var(--color-down); width: 95%; }
.strength-fill.sell { background-color: #f87171; width: 70%; }

/* Live tick price updates */
.tick-up {
  animation: flash-green-tick 0.8s ease-out;
}

.tick-down {
  animation: flash-red-tick 0.8s ease-out;
}

@keyframes flash-green-tick {
  0% { background-color: rgba(16, 185, 129, 0.4); color: #fff; }
  100% { background-color: transparent; }
}

@keyframes flash-red-tick {
  0% { background-color: rgba(239, 68, 68, 0.4); color: #fff; }
  100% { background-color: transparent; }
}

/* Up/Down coloring */
.text-up {
  color: var(--color-up) !important;
}

.text-down {
  color: var(--color-down) !important;
}

/* MAIN CENTRAL AREA - MIDDLE ACTION PANEL */
.center-action-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

.info-links-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.01);
  border-left: 2px solid transparent;
}

.info-link:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.03);
  border-left-color: var(--color-accent);
}

.info-link span {
  font-size: 0.7rem;
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-accent);
  padding: 1px 5px;
  border-radius: 3px;
}

.batch-actions-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.batch-actions-box .btn {
  padding: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

/* MAIN CENTRAL AREA - RIGHT PORTFOLIO PANEL */
.portfolio-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.portfolio-table-wrapper {
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  margin-bottom: 12px;
}

.mtom-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 14px;
  text-align: center;
  margin-bottom: 12px;
  border-left: 4px solid var(--color-accent);
}

.mtom-box.profit {
  border-left-color: var(--color-up);
  box-shadow: inset 4px 0 0 var(--color-up), 0 0 10px rgba(16, 185, 129, 0.1);
}

.mtom-box.loss {
  border-left-color: var(--color-down);
  box-shadow: inset 4px 0 0 var(--color-down), 0 0 10px rgba(239, 68, 68, 0.1);
}

.mtom-box span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.mtom-box h2 {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
}

.mtom-box.profit h2 {
  color: #00e5ff; /* Turquoise */
}

.mtom-box.loss h2 {
  color: var(--color-down); /* Red */
}

.portfolio-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.portfolio-actions .btn {
  padding: 10px 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* FOOTER SECTION */
.dashboard-footer {
  grid-column: span 3;
  display: grid;
  grid-template-columns: 2.2fr 1fr 1.3fr;
  gap: 16px;
  align-items: center;
  background: rgba(9, 12, 28, 0.85);
  border-top: 1px solid var(--border-light);
  padding: 10px 16px;
  border-bottom-left-radius: var(--border-radius-lg);
  border-bottom-right-radius: var(--border-radius-lg);
  font-size: 0.75rem;
}

.notification-marquee {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  height: 28px;
}

.marquee-badge {
  background: var(--color-accent-glow);
  color: var(--color-accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

.marquee-text-container {
  overflow: hidden;
  white-space: nowrap;
  flex-grow: 1;
  position: relative;
}

.marquee-text {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 120s linear infinite;
  color: var(--color-text-secondary);
}

.marquee-text span {
  margin-right: 40px;
}

@keyframes marquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

.funds-container {
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.funds-container strong {
  font-family: var(--font-mono);
  color: var(--color-text-primary);
  font-size: 0.95rem;
}

.uptime-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  color: var(--color-text-muted);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.status-dot.connected {
  background: var(--color-up);
  box-shadow: 0 0 8px var(--color-up);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

/* MODALS OVERLAY SYSTEM */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 4, 10, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-dashboard);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color var(--transition-fast);
}

.close-modal-btn:hover {
  color: var(--color-text-primary);
}

.modal-content {
  padding: 20px;
  overflow-y: auto;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--color-text-primary);
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-group p.help-text {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Specific Modals Content */
/* P/L Report / Charts Modal */
.chart-modal {
  max-width: 750px;
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 12px;
}

/* Credits Modal Pack Selection */
.credits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.credit-pack {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.credit-pack:hover {
  background: rgba(59, 130, 246, 0.05);
  border-color: var(--color-accent);
}

.credit-pack.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.credit-pack h4 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.credit-pack p.price {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-up);
  margin-bottom: 10px;
}

.credit-pack span {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* User Guide Styles */
.guide-content h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-top: 16px;
  margin-bottom: 8px;
}

.guide-content h4:first-child {
  margin-top: 0;
}

.guide-content p, .guide-content li {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.guide-content ul {
  padding-left: 20px;
}

/* Loader Animation for Scan or Broker Link */
.pulse-loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

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

/* Alert Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--border-radius-sm);
  padding: 12px 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.8rem;
  min-width: 250px;
  animation: slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(12px);
}

.toast.success { border-left-color: var(--color-up); }
.toast.error { border-left-color: var(--color-down); }
.toast.warning { border-left-color: var(--color-warn); }

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

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

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Stoploss input box */
.stoploss-input {
  width: 60px;
  background: var(--bg-darker);
  border: 1px solid var(--border-light);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: 2px;
  text-align: right;
}

.stoploss-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Sortable column headers */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-th:hover {
  color: var(--color-text-primary);
}

.sortable-th.sort-active {
  color: var(--color-accent);
}

.sort-icon {
  display: inline-block;
  margin-left: 3px;
  font-size: 0.65rem;
  opacity: 0.4;
  vertical-align: middle;
}

.sortable-th:hover .sort-icon {
  opacity: 0.7;
}

.sortable-th.sort-active .sort-icon {
  opacity: 1;
  color: var(--color-accent);
}

/* Responsive Scaling for medium viewports */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 2.2fr 1fr 1.3fr;
  }
}

@media (max-width: 992px) {
  body {
    zoom: 1;
    height: auto;
    min-height: 100vh;
    padding: 10px;
    overflow: auto;
    touch-action: auto;
  }
  .auth-screen {
    height: auto;
    min-height: 100vh;
    padding: 20px;
  }
  .admin-screen {
    height: auto;
    min-height: 100vh;
    padding: 20px;
  }
  .auth-grid,
  .auth-actions {
    grid-template-columns: 1fr;
  }
  .admin-summary,
  .admin-workspace,
  .admin-add-grid,
  .admin-editor-actions {
    grid-template-columns: 1fr;
  }
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-top-section {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }
  .dashboard-footer {
    grid-column: span 1;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .uptime-container {
    justify-content: flex-start;
  }
}

/* Mobile touch fixes */
@media (max-width: 768px) {
  body {
    zoom: 1;
    overflow: auto;
  }
  .btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  input, select {
    font-size: 16px; /* prevents iOS auto-zoom on input focus */
    touch-action: manipulation;
  }
  .form-group input,
  .form-group select {
    font-size: 16px;
  }
}
