/* Custom Properties for Premium Cyberpunk/Holographic Executive Aesthetic */
:root {
  --bg-dark: #030408;
  --panel-bg: rgba(6, 8, 15, 0.65);
  --panel-bg-inner: rgba(255, 255, 255, 0.02);
  --panel-bg-inner-hover: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.07);
  --border-color-glow: rgba(0, 242, 254, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #475569;
  
  /* Brand/Category Themes */
  --ai-cyan: #00f2fe;
  --ai-cyan-glow: rgba(0, 242, 254, 0.35);
  --hr-purple: #c084fc;
  --hr-purple-glow: rgba(192, 132, 252, 0.35);
  --amber: #fbbf24;
  --amber-glow: rgba(251, 191, 36, 0.35);
  
  /* Font Stacks */
  --font-hud: 'Outfit', sans-serif;
  --font-thai: 'Prompt', sans-serif;
  
  --transition-speed: 0.3s;
}

/* Base resets and configuration */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-thai);
  color: var(--text-main);
  user-select: none;
}

/* 3D Canvas Background Container */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Futuristic HUD Grid Overlay */
.tech-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(16, 20, 36, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 20, 36, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 2;
  pointer-events: none;
}
.tech-grid-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 30%, rgba(3, 4, 8, 0.75) 85%);
  z-index: 2;
}

/* Glassmorphism styling helper */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.6);
  transition: all var(--transition-speed) ease;
}
.glass-panel-inner {
  background: var(--panel-bg-inner);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
}

/* main HUD Layout grid */
#hud-layout {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  display: grid;
  grid-template-rows: 72px 1fr 90px;
  pointer-events: none;
  padding: 16px;
  gap: 16px;
}

#hud-layout * {
  pointer-events: auto; /* Re-enable pointer events inside children */
}

/* HEADER BAR STYLING */
.hud-header {
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: rgba(6, 8, 15, 0.55);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.synergy-orb-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ai-cyan), var(--hr-purple));
  position: relative;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.5);
  animation: rotateOrb 6s linear infinite;
}
.synergy-orb-icon .inner-core {
  width: 8px;
  height: 8px;
  background: var(--text-main);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes rotateOrb {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.logo-text h1 {
  font-family: var(--font-hud);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2.5px;
  background: linear-gradient(90deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.logo-text .sub-logo {
  font-family: var(--font-hud);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--ai-cyan);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 242, 254, 0.04);
  border: 1px solid rgba(0, 242, 254, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--font-hud);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
}
.status-indicator.live {
  color: var(--ai-cyan);
}
.status-indicator .ping-dot {
  width: 6px;
  height: 6px;
  background-color: var(--ai-cyan);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 8px var(--ai-cyan);
}
.status-indicator .ping-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--ai-cyan);
  animation: pulsePing 2s ease-out infinite;
}

@keyframes pulsePing {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.vertical-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-color);
}

.date-badge {
  font-family: var(--font-thai);
  font-size: 13px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.hud-btn-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hud-btn-circle svg {
  width: 18px;
  height: 18px;
}
.hud-btn-circle:hover {
  background: var(--border-color);
  border-color: var(--ai-cyan);
  color: var(--ai-cyan);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}
.hud-btn-circle.highlight {
  border-color: var(--amber-glow);
  color: var(--amber);
}
.hud-btn-circle.highlight:hover {
  border-color: var(--amber);
  color: var(--bg-dark);
  background: var(--amber);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

/* MAIN CONTENT AREA LAYOUT (HIGH DENSITY 3-COLUMNS) */
.hud-main {
  grid-row: 2;
  display: grid;
  grid-template-columns: 460px 1fr 460px;
  gap: 16px;
  height: 100%;
  overflow: hidden;
}

/* PANELS ARCHITECTURE */
.hud-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 4;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.15);
}
.title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-family: var(--font-hud);
  color: var(--text-main);
  text-transform: uppercase;
}
.panel-icon {
  width: 18px;
  height: 18px;
}
.item-count-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.text-cyan { color: var(--ai-cyan) !important; filter: drop-shadow(0 0 3px var(--ai-cyan-glow)); }
.text-purple { color: var(--hr-purple) !important; filter: drop-shadow(0 0 3px var(--hr-purple-glow)); }
.text-amber { color: var(--amber) !important; filter: drop-shadow(0 0 3px var(--amber-glow)); }

.scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Scrollbar custom styles */
.scroll-content::-webkit-scrollbar {
  width: 4px;
}
.scroll-content::-webkit-scrollbar-track {
  background: transparent;
}
.scroll-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}
.scroll-content::-webkit-scrollbar-thumb:hover {
  background: var(--ai-cyan);
}

/* HIGH DENSITY NEWS CARDS */
.briefing-card {
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  background: rgba(10, 14, 26, 0.45);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.index-number {
  font-family: var(--font-hud);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}
.briefing-card:hover .index-number {
  color: var(--text-muted);
}

.card-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-main);
  flex: 1;
}

.card-expand-icon {
  color: var(--text-dark);
  transition: transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
}
.card-expand-icon svg {
  width: 14px;
  height: 14px;
}

/* Expandable content area */
.card-body-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), margin-top 0.3s ease;
  opacity: 0;
}

.card-body-details p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: justify;
}

.detail-block {
  margin-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.04);
  padding-top: 10px;
}
.detail-block h4 {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-block h4 svg {
  width: 12px;
  height: 12px;
}

/* Recommendation list */
.card-rec-list {
  list-style: none;
}
.card-rec-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.card-rec-list li::before {
  content: '✓';
  position: absolute;
  left: 2px;
  top: 0px;
  font-size: 10px;
  font-weight: bold;
}

/* HOVER & EXPANDED STATES FOR CATEGORIES */
/* AI Theme Card Styles */
.ai-card:hover {
  border-color: rgba(0, 242, 254, 0.25);
  background: rgba(0, 242, 254, 0.02);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.04);
}
.ai-card.expanded {
  border-color: var(--ai-cyan-glow);
  background: rgba(0, 242, 254, 0.04);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.06);
}
.ai-card .detail-block h4 { color: var(--ai-cyan); }
.ai-card .card-rec-list li::before { color: var(--ai-cyan); }
.ai-card.expanded .card-expand-icon { transform: rotate(180deg); color: var(--ai-cyan); }
.ai-card.expanded .index-number { border-color: var(--ai-cyan); color: var(--ai-cyan); }

/* HR Theme Card Styles */
.hr-card:hover {
  border-color: rgba(192, 132, 252, 0.25);
  background: rgba(192, 132, 252, 0.02);
  box-shadow: 0 4px 15px rgba(192, 132, 252, 0.04);
}
.hr-card.expanded {
  border-color: var(--hr-purple-glow);
  background: rgba(192, 132, 252, 0.04);
  box-shadow: 0 0 15px rgba(192, 132, 252, 0.06);
}
.hr-card .detail-block h4 { color: var(--hr-purple); }
.hr-card .card-rec-list li::before { color: var(--hr-purple); }
.hr-card.expanded .card-expand-icon { transform: rotate(180deg); color: var(--hr-purple); }
.hr-card.expanded .index-number { border-color: var(--hr-purple); color: var(--hr-purple); }

/* Expanded class body reveal */
.briefing-card.expanded .card-body-details {
  max-height: 500px;
  opacity: 1;
  margin-top: 12px;
}

/* CENTER SPACE OVERLAYS */
.hud-center-space {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  pointer-events: none; /* Pass clicks to WebGL */
}

.interaction-hint {
  background: rgba(3, 4, 8, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  color: var(--text-muted);
  backdrop-filter: blur(8px);
}
.interaction-hint svg {
  width: 10px;
  height: 10px;
}

.active-node-tag {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-hud);
  font-weight: 500;
  margin-bottom: 8px;
}
.node-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ai-cyan);
  box-shadow: 0 0 8px var(--ai-cyan);
}

.center-executive-panel {
  pointer-events: auto;
  width: 100%;
  max-width: 480px;
  height: 480px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 16px;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
  margin: auto 0;
}

/* Dynamic glow styling for center panel */
.center-executive-panel.ai-glow {
  border-color: var(--ai-cyan-glow);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.1), inset 0 0 25px rgba(0, 242, 254, 0.02);
}
.center-executive-panel.hr-glow {
  border-color: var(--hr-purple-glow);
  box-shadow: 0 0 25px rgba(192, 132, 252, 0.1), inset 0 0 25px rgba(192, 132, 252, 0.02);
}

/* Welcome state styles */
.center-panel-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 16px;
  padding: 20px;
}
.center-panel-welcome h3 {
  font-family: var(--font-hud);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-main);
  margin-top: 8px;
}
.center-panel-welcome p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}
.center-panel-welcome .welcome-icon {
  width: 44px;
  height: 44px;
  color: var(--ai-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
  animation: pulseWelcome 2.5s infinite ease-in-out;
}
@keyframes pulseWelcome {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px rgba(0, 242, 254, 0.6)); }
}
.center-panel-welcome .instruction-label {
  font-size: 11px;
  color: var(--text-dark);
  border-top: 1px dashed rgba(255, 255, 255, 0.04);
  width: 100%;
  padding-top: 14px;
  margin-top: 10px;
}

/* Active panel content styles */
.center-panel-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.center-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.close-detail-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s;
}
.close-detail-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
}
.close-detail-btn svg {
  width: 14px;
  height: 14px;
}

#center-news-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.center-scroll-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}
.center-scroll-content::-webkit-scrollbar {
  width: 3px;
}
.center-scroll-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}

.center-block h4 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.center-block h4 svg {
  width: 13px;
  height: 13px;
}
.center-block p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: justify;
}

/* Recommendations inside center panel */
.center-rec-list {
  list-style: none;
}
.center-rec-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.center-rec-list li::before {
  content: '✓';
  position: absolute;
  left: 2px;
  top: 0px;
  font-size: 10px;
  font-weight: bold;
}

.center-executive-panel.ai-glow .center-block h4 { color: var(--ai-cyan); }
.center-executive-panel.ai-glow .center-rec-list li::before { color: var(--ai-cyan); }

.center-executive-panel.hr-glow .center-block h4 { color: var(--hr-purple); }
.center-executive-panel.hr-glow .center-rec-list li::before { color: var(--hr-purple); }

.dispatch-center-badge {
  pointer-events: auto;
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(6px);
  margin-bottom: 8px;
}
.dispatch-center-badge .dispatch-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-family: var(--font-hud);
}
.dispatch-center-badge .dispatch-title svg {
  width: 12px;
  height: 12px;
}

/* TIMELINE FOOTER STYLING */
.hud-footer {
  grid-row: 3;
  display: flex;
  justify-content: center;
  align-items: center;
}

.timeline-container {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 600px;
  height: 52px;
  padding: 0 10px;
  z-index: 4;
}

.timeline-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: background 0.3s;
}
.timeline-nav-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-main);
}
.timeline-nav-btn svg {
  width: 16px;
  height: 16px;
}

.timeline-dates-wrapper {
  flex: 1;
  display: flex;
  justify-content: space-around;
  align-items: center;
  overflow: hidden;
  height: 100%;
  padding: 0 15px;
}

.timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding: 4px 8px;
}
.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dark);
  margin-bottom: 2px;
  transition: all 0.3s ease;
}
.timeline-date-label {
  font-family: var(--font-hud);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-dark);
  transition: color 0.3s;
}

/* Timeline Active Node state */
.timeline-node.active .timeline-dot {
  background-color: var(--ai-cyan);
  box-shadow: 0 0 8px var(--ai-cyan);
  transform: scale(1.2);
}
.timeline-node.active .timeline-date-label {
  color: var(--ai-cyan);
  font-weight: 700;
}
.timeline-node.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  width: 18px;
  height: 2px;
  background-color: var(--ai-cyan);
  box-shadow: 0 0 6px var(--ai-cyan);
}

/* SETTINGS MODAL */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 3, 5, 0.75);
  backdrop-filter: blur(12px);
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 90%;
  max-width: 480px;
  border-color: rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateY(15px);
  transition: transform 0.3s ease;
}
.modal-overlay.open .modal-container {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title h3 {
  font-size: 15px;
  font-weight: 600;
}
.modal-title svg {
  width: 18px;
  height: 18px;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s;
}
.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
}
.modal-intro {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.form-control {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px 12px;
  font-family: var(--font-thai);
  font-size: 12.5px;
}
.form-control:focus {
  outline: none;
  border-color: var(--ai-cyan);
}
select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
}

.row-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.row-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--ai-cyan);
  cursor: pointer;
}
.row-checkbox label {
  text-transform: none;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-main);
  cursor: pointer;
}

.active-cron-status {
  padding: 10px;
  font-size: 10.5px;
}
.active-cron-status .status-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 4px;
}
.active-cron-status .status-header svg {
  width: 12px;
  height: 12px;
}
.active-cron-status .status-details code {
  font-family: monospace;
  color: var(--ai-cyan);
}
.active-cron-status .status-details p {
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-thai);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-main);
}
.btn-primary {
  background: var(--ai-cyan);
  border: 1px solid var(--ai-cyan);
  color: #020305;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}
.btn-primary:hover {
  background: #00d2dc;
  border-color: #00d2dc;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

/* Toast System */
.toast-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}
.toast {
  background: rgba(6, 8, 15, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 300px;
  max-width: 360px;
  display: flex;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.toast-out {
  animation: toastOut 0.3s ease-in forwards;
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(40px); opacity: 0; }
}

.toast-icon {
  width: 22px;
  height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast-icon.cyan-bg { background: rgba(0, 242, 254, 0.1); color: var(--ai-cyan); }
.toast-icon.purple-bg { background: rgba(192, 132, 252, 0.1); color: var(--hr-purple); }
.toast-icon.amber-bg { background: rgba(251, 191, 36, 0.1); color: var(--amber); }

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toast-title {
  font-size: 12px;
  font-weight: 600;
}
.toast-msg {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}


/* WIDGETS STYLING */
.panel-widget {
  margin: 4px 16px 16px 16px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.widget-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.widget-title h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-main);
  font-family: var(--font-thai);
}
.widget-date-sub {
  font-size: 8px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.2px;
  opacity: 0.8;
}
.widget-title svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Gold Widget Styles */
.gold-categories-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gold-category-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gold-category-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 2px solid var(--amber);
  padding-left: 6px;
  margin-bottom: 2px;
}
.gold-prices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.price-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.gold-widget .price-box {
  padding: 5px 10px;
}
.price-label {
  font-size: 9.5px;
  color: var(--text-muted);
}
.price-value {
  font-size: 16px;
  font-family: var(--font-hud);
  font-weight: 700;
  color: var(--amber);
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.2);
}
.gold-widget .price-value {
  font-size: 14px;
}
.gold-change-badge {
  font-size: 10px;
  font-family: var(--font-hud);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.gold-change-badge.positive {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}
.gold-change-badge.negative {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}
.gold-change-badge.neutral {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
}

/* Fuel Widget Styles */
.date-tag-mini {
  font-size: 9px;
  color: var(--text-dark);
}
.fuel-prices-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.fuel-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.fuel-name {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.fuel-price {
  font-size: 13.5px;
  font-family: var(--font-hud);
  font-weight: 700;
  color: var(--hr-purple);
  text-shadow: 0 0 6px rgba(192, 132, 252, 0.2);
}

/* Secure PIN Entry Overlay */
.pin-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #06080f 0%, #020305 100%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.5s ease, pointer-events 0.5s ease;
}
.pin-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}
.pin-authenticated .pin-overlay {
  display: none !important;
}

.pin-container {
  width: 90%;
  max-width: 360px;
  padding: 30px 24px;
  text-align: center;
  border-color: rgba(0, 242, 254, 0.15);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 242, 254, 0.05);
}

.pin-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.synergy-orb-icon.large {
  width: 36px;
  height: 36px;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.6);
}
.synergy-orb-icon.large .inner-core {
  width: 12px;
  height: 12px;
}
.pin-header h2 {
  font-family: var(--font-hud);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text-main);
}
.pin-header p {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.pin-display-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}
.pin-dot-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}
.pin-dot-indicator.filled {
  background-color: var(--ai-cyan);
  border-color: var(--ai-cyan);
  box-shadow: 0 0 10px var(--ai-cyan);
  transform: scale(1.15);
}
.pin-dot-indicator.error {
  background-color: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.key-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: var(--font-hud);
  font-size: 18px;
  font-weight: 600;
  height: 52px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}
.key-btn:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--ai-cyan);
  color: var(--ai-cyan);
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}
.key-btn:active {
  transform: scale(0.95);
}
.key-btn.text-key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.key-btn.text-key:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  box-shadow: none;
}

.pin-feedback {
  font-family: var(--font-hud);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dark);
  margin-top: 16px;
  text-transform: uppercase;
  transition: color 0.3s;
}
.pin-feedback.error-text {
  color: #ef4444;
  animation: shake 0.4s ease-in-out;
}

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

/* RESPONSIVE LAYOUT (Moved to the bottom to override default styles correctly in the cascade) */
/* TABLET LAYOUT RESPONSIVENESS */
@media (min-width: 769px) and (max-width: 1200px) {
  #hud-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    pointer-events: auto;
    padding: 16px;
    gap: 16px;
  }
  .hud-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: auto;
    overflow: visible;
  }
  .left-panel, .right-panel {
    width: 100% !important;
  }
  .hud-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .scroll-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  /* Slide-up Center Panel drawer on Mobile/Tablet */
  .hud-center-space {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align drawer to the bottom */
    padding: 0;
    background: transparent;
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
  }
  
  .hud-center-space.active-backdrop {
    pointer-events: auto;
    background: rgba(3, 4, 8, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  
  .center-executive-panel {
    pointer-events: auto;
    width: 100% !important;
    max-width: 600px;
    height: 70vh !important;
    max-height: 550px;
    transform: translateY(100vh);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9);
    position: relative;
    z-index: 600;
    border-radius: 20px 20px 0 0 !important; /* Rounded top, flat bottom */
    margin: 0;
    border-bottom: none !important;
  }

  .center-executive-panel.active-open {
    transform: translateY(0);
  }
  
  .center-panel-welcome {
    display: none !important;
  }
  
  .interaction-hint, .active-node-tag {
    display: none !important;
  }
  
  #canvas-container {
    opacity: 0.4;
  }
}

/* MOBILE LAYOUT RESPONSIVENESS */
@media (max-width: 768px) {
  #hud-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    pointer-events: auto;
    padding: 12px;
    gap: 12px;
  }
  .hud-main {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    gap: 12px;
  }
  .left-panel, .right-panel {
    width: 100% !important;
  }
  .hud-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .scroll-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  /* Slide-up Center Panel drawer on Mobile/Tablet */
  .hud-center-space {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align drawer to the bottom */
    padding: 0;
    background: transparent;
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
  }
  
  .hud-center-space.active-backdrop {
    pointer-events: auto;
    background: rgba(3, 4, 8, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  
  .center-executive-panel {
    pointer-events: auto;
    width: 100% !important;
    max-width: 100%; /* Take full width on mobile */
    height: 80vh !important;
    max-height: none;
    transform: translateY(100vh);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9);
    position: relative;
    z-index: 600;
    border-radius: 20px 20px 0 0 !important; /* Rounded top, flat bottom */
    margin: 0;
    border-bottom: none !important;
  }

  .center-executive-panel.active-open {
    transform: translateY(0);
  }
  
  .center-panel-welcome {
    display: none !important;
  }
  
  .interaction-hint, .active-node-tag {
    display: none !important;
  }
  
  #canvas-container {
    opacity: 0.3;
  }

  /* Header mobile optimization */
  .hud-header {
    padding: 0 12px;
    height: 60px;
    min-height: 60px;
  }
  .logo-text h1 {
    font-size: 13px;
    letter-spacing: 1.5px;
  }
  .logo-text .sub-logo {
    font-size: 7.5px;
    letter-spacing: 1.5px;
  }
  .header-status {
    display: none !important; /* Hide direct sync status and date in header on mobile */
  }
  .header-actions {
    gap: 6px;
  }
  .hud-btn-circle {
    width: 32px;
    height: 32px;
  }
  .hud-btn-circle svg {
    width: 15px;
    height: 15px;
  }

  /* Keypad responsiveness on smaller mobile screens */
  .pin-container {
    padding: 24px 16px !important;
  }
  .pin-header h2 {
    font-size: 14px !important;
  }
  .pin-keypad {
    gap: 8px !important;
  }
  .key-btn {
    height: 46px !important;
    font-size: 16px !important;
  }
}

/* LANDSCAPE ORIENTATION RESPONSIVENESS FOR SHORT HEIGHTS */
@media (max-height: 550px) {
  .pin-overlay {
    align-items: center !important;
  }
  .pin-container {
    padding: 16px 20px !important;
    max-width: 480px !important;
    margin: auto;
  }
  .pin-header {
    margin-bottom: 10px !important;
    flex-direction: row !important;
    justify-content: center !important;
    gap: 12px !important;
  }
  .pin-header .synergy-orb-icon {
    width: 24px !important;
    height: 24px !important;
  }
  .pin-header h2 {
    font-size: 13px !important;
    margin: 0 !important;
  }
  .pin-header p {
    display: none !important;
  }
  .pin-display-row {
    margin: 8px 0 !important;
    gap: 12px !important;
  }
  .pin-dot-indicator {
    width: 10px !important;
    height: 10px !important;
  }
  .pin-keypad {
    grid-template-columns: repeat(6, 1fr) !important; /* 6 columns instead of 3 */
    gap: 6px !important;
    margin: 8px 0 !important;
  }
  .key-btn {
    height: 38px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
  }
  .pin-feedback {
    margin-top: 6px !important;
    font-size: 8.5px !important;
  }
}

