:root {
  --bg-color: #f8fafc;
  --panel-bg: #ffffff;
  --panel-border: #e2e8f0;
  --panel-border-hover: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-blue-light: #eff6ff;
  --accent-gold: #b45309;
  --gold-bg: #fef3c7;
  --gold-border: #fde68a;
  
  --positive: #16a34a;
  --positive-bg: #dcfce7;
  --positive-border: #bbf7d0;
  --negative: #dc2626;
  --negative-bg: #fee2e2;
  --negative-border: #fecaca;
  
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-border: #fde68a;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

  --font-main: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Ubuntu Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.5;
  padding: 14px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout Wrapper */
.main-wrapper {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Top Control Bar (Clean 1-Line Row Layout) */
.top-controls-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap !important;
  gap: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.top-controls-bar::-webkit-scrollbar {
  display: none;
}

.ctrl-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap !important;
  flex-shrink: 0;
}

.ctrl-cluster-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap !important;
  flex-shrink: 0;
}

/* Switch & Live Row */
.cp-live-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  padding: 3px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
}

.iswitch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}

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

.islider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #10b981;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-full);
}

.islider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

input:checked + .islider {
  background-color: #f59e0b;
}

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

.sw-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.2s ease;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sw-label.active-real {
  color: #059669;
}

.sw-label.active-fake {
  color: #d97706;
}

/* Status Indicator Dots */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--positive-bg);
  color: var(--positive);
  border: 1px solid var(--positive-border);
}

.live-badge.badge-simulated {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;
  animation: pulse-dot 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

/* Feed Status Pill (Replaces toggles: indicates Live API, Fallback, or Scraper) */
.feed-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  height: 32px;
  box-sizing: border-box;
  white-space: nowrap;
  transition: all 0.25s ease;
  user-select: none;
}

/* Live API (Green) */
.feed-status-pill.status-live {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

/* Fallback Scraper (Amber/Orange - after Metals-API limit reached) */
.feed-status-pill.status-fallback {
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Night Scraper (Blue - 11 PM to 9 AM) */
.feed-status-pill.status-scraper {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;
  animation: pulse-dot 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

/* Button Groups & Dropdowns */
.btn-group {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  gap: 2px;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
}

.toggle-btn, .unit-btn {
  background: transparent;
  border: none;
  color: #475569;
  padding: 3px 8px;
  min-height: 26px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover, .unit-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
}

.toggle-btn:active, .unit-btn:active {
  transform: scale(0.97);
}

.toggle-btn.active, .unit-btn.active {
  background-color: #0f172a;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

/* Weight Unit Dropdown */
.unit-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.unit-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 0 24px 0 10px;
  height: 32px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.3px;
  user-select: none;
}

.unit-select:hover {
  background: #1e293b;
  border-color: #334155;
}

.unit-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.unit-select option {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
  padding: 6px 10px;
}

.unit-select-wrap .select-arrow {
  position: absolute;
  right: 8px;
  pointer-events: none;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Action Buttons (Refresh & Analytics) */
.cp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 11.5px;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.cp-btn.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
}

.cp-btn.btn-primary:hover {
  background: var(--accent-blue-hover);
}

.cp-btn.btn-secondary {
  background: #f8fafc;
  color: var(--text-secondary);
  border-color: var(--panel-border);
}

.cp-btn.btn-secondary:hover {
  background: #f1f5f9;
  color: var(--text-primary);
  border-color: var(--panel-border-hover);
}

.cp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Engine Start/Stop (Pause/Resume) Button */
.cp-btn.btn-engine {
  font-weight: 700;
  border-width: 1.5px;
  border-style: solid;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
}

.cp-btn.btn-engine .engine-icon {
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.cp-btn.btn-engine.running {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.cp-btn.btn-engine.running:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.cp-btn.btn-engine.stopped {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.cp-btn.btn-engine.stopped:hover {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

/* Auto Schedule Toggle Button */
.cp-btn.btn-auto-schedule {
  font-weight: 700;
  border-width: 1.5px;
  border-style: solid;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
}

.cp-btn.btn-auto-schedule .auto-icon {
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.cp-btn.btn-auto-schedule.auto-on {
  background: rgba(37, 99, 235, 0.12);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.35);
}

.cp-btn.btn-auto-schedule.auto-on:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.6);
  color: #60a5fa;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.cp-btn.btn-auto-schedule.auto-off {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.cp-btn.btn-auto-schedule.auto-off:hover {
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.5);
  color: #cbd5e1;
}

.timer-val.paused {
  color: #d97706 !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px;
}

/* Meta Info Pill */
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 3px 8px;
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
  font-size: 11px;
  white-space: nowrap;
}

.meta-lbl {
  color: var(--text-muted);
  font-weight: 600;
}

.meta-val {
  color: var(--text-secondary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.timer-val {
  color: var(--negative) !important;
  font-weight: 700 !important;
  font-family: var(--font-mono);
}

/* Rates Panel */
.rates-panel {
  width: 100%;
}

.horizontal-rates-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

/* Metal Card */
.metal-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.metal-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.metal-card.gold-highlight {
  border-left: 4px solid #f59e0b;
}

.metal-card.silver-highlight {
  border-left: 4px solid #64748b;
}

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

.mc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mc-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.mc-symbol {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  font-family: var(--font-mono);
}

.mc-purity {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

.badge-change {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.badge-change.pos {
  background: var(--positive-bg);
  color: var(--positive);
  border: 1px solid var(--positive-border);
}

.badge-change.neg {
  background: var(--negative-bg);
  color: var(--negative);
  border: 1px solid var(--negative-border);
}

/* Two-column ASK / BID Grid */
.ask-bid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ab-col {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
}

.ask-col {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.bid-col {
  background: #fffbeb;
  border-color: #fde68a;
}

.ab-header {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ask-col .ab-header { color: #15803d; }
.bid-col .ab-header { color: #b45309; }

.ab-spot {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.1;
  letter-spacing: -0.4px;
}

.ab-unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.ab-breakdown {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 8px;
  margin-top: auto;
}

.ab-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #475569;
}

.ab-row span:first-child { font-weight: 500; }
.ab-row span:last-child  { font-family: var(--font-mono); font-weight: 600; }

.ab-final {
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px solid #cbd5e1;
  font-size: 12px !important;
}

.ask-col .ab-final span { color: #15803d !important; font-weight: 800 !important; }
.bid-col .ab-final span { color: #b45309 !important; font-weight: 800 !important; }

/* Skeleton Loading States */
.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skeleton-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.skeleton-shimmer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.65) 50%, rgba(255, 255, 255, 0) 100%);
  animation: shimmer 1.5s infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-box {
  background: #e2e8f0;
  border-radius: var(--radius-sm);
}

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

.skeleton-title {
  width: 130px;
  height: 22px;
}

.skeleton-badge {
  width: 60px;
  height: 20px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.skeleton-col {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-spot {
  width: 110px;
  height: 24px;
}

.skeleton-line {
  width: 100%;
  height: 12px;
}

.skeleton-line.short {
  width: 60%;
}

/* State Boxes */
.state-box {
  text-align: center;
  padding: 40px 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.state-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 360px;
  margin-bottom: 14px;
}

.spinning {
  animation: spin 1s linear infinite;
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  width: calc(100vw - 40px);
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.toast-success { background: #064e3b; border-color: #059669; }
.toast.toast-error { background: #7f1d1d; border-color: #dc2626; }
.toast.toast-warning { background: #78350f; border-color: #d97706; }
.toast.toast-info { background: #1e3a8a; border-color: #2563eb; }
.toast.toast-hiding { opacity: 0; transform: translateY(10px) scale(0.95); }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 20px 0 10px;
  margin-top: auto;
}

.footer code {
  color: var(--accent-blue);
  background: var(--accent-blue-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Analytics Specific */
.analytics-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.analytics-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.analytics-brand h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.analytics-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.analytics-date-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-input {
  padding: 6px 10px;
  min-height: 36px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 12px;
  color: var(--text-primary);
  background: #f8fafc;
  outline: none;
}

.btn-filter {
  background: #0f172a;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.btn-clear-date {
  background: var(--negative-bg);
  color: var(--negative);
  border: 1px solid var(--negative-border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.analytics-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}

.analytics-tab-btn {
  padding: 7px 14px;
  min-height: 36px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.analytics-tab-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.4px;
}

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

.table-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-top: 18px;
}

.table-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.table-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
}

.table-scroll-hint {
  display: none;
  font-size: 10px;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}

/* Responsive Media Queries */
@media (max-width: 860px) {
  body { padding: 10px; }
  .table-scroll-hint { display: inline-block; }
}

@media (max-width: 600px) {
  body { padding: 8px; }
  .ask-bid-grid { grid-template-columns: 1fr; gap: 10px; }
  .top-controls-bar { gap: 6px; padding: 6px 8px; }
  .analytics-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Admin Authentication & Protected Controls
   ========================================================================== */

/* By default, all admin clusters are hidden */
.admin-only-cluster {
  display: none !important;
}

/* When body has is-admin class, show all admin clusters */
body.is-admin .admin-only-cluster {
  display: flex !important;
}
body.is-admin span.admin-only-cluster {
  display: inline !important;
}

/* Admin Toggle Button */
.btn-admin-toggle {
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid var(--panel-border);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-admin-toggle:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

body.is-admin .btn-admin-toggle {
  background: var(--positive-bg);
  color: var(--positive);
  border-color: var(--positive-border);
}

body.is-admin .btn-admin-toggle:hover {
  background: #bbf7d0;
}

/* Admin Modal Overlay */
.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.admin-modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--panel-border);
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(12px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

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

.admin-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.admin-modal-icon {
  color: var(--accent-blue);
  display: flex;
  align-items: center;
}

.admin-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

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

.admin-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.admin-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.admin-input-group input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  font-size: 13px;
  font-family: var(--font-mono);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: #ffffff;
  color: var(--text-primary);
}

.admin-input-group input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-toggle-eye:hover {
  color: var(--text-primary);
}

.admin-auth-error {
  color: var(--negative);
  background: var(--negative-bg);
  border: 1px solid var(--negative-border);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.admin-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

