:root {
  --bg: #0b0d12;
  --surface: #141821;
  --border: #2a2f3a;
  --text: #e6e9f0;
  --muted: #6b7280;
  --accent: #FF6D00;
  --accent-glow: rgba(91, 124, 255, 0.15);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #ef4444;
  --purple: #a855f7;
  --teal: #14b8a6;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  padding: 1rem;
  min-height: 100vh;
  position: relative;
}

/* Layout */
.container {
  max-width: 960px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

h1 {
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

nav {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.35rem;
  border-radius: var(--radius);
  width: fit-content;
  flex-wrap: wrap;
}

nav button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 70px;
  text-align: center;
  font-size: 0.9rem;
}

nav button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

nav button:hover:not(.active) {
  color: var(--text);
}

/* System Icon */
.system-icon {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.system-icon:hover {
  background: var(--accent);
  transform: scale(1.1);
}

.system-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
}

.system-icon:hover svg {
  fill: white;
}

/* System Menu */
.system-menu {
  position: fixed;
  bottom: 60px;
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  width: 280px;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
}

.system-menu.open {
  display: block;
  animation: fadeIn 0.2s;
}

.system-menu h3 {
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.system-menu .btn {
  width: 100%;
  margin-bottom: 0.75rem;
  text-align: center;
  padding: 0.75rem;
  font-size: 0.95rem;
}

.system-menu .btn:last-child {
  margin-bottom: 0;
}

/* Sections */
.section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards & UI */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--accent);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  font-size: 0.75rem;
  margin-right: 0.4rem;
  color: var(--muted);
}

/* Forms & Inputs */
input,
textarea,
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem;
  border-radius: var(--radius);
  font-family: inherit;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s;
  font-size: 1rem;
  display: inline-block;
  text-align: center;
  min-width: 120px;
  font-size: 0.95rem;
}

.btn:hover {
  opacity: 0.9;
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn.danger {
  background: var(--danger);
}

/* Progress & Status */
.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s ease;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  display: inline-block;
  margin-bottom: 0.5rem;
}

/* Cognitive Load Meter */
.load-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.load-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  min-width: 100px;
}

.load-fill {
  height: 100%;
  transition:
    width 0.4s,
    background 0.4s;
  width: 30%;
  background: var(--success);
}

.load-fill.medium {
  background: var(--warning);
}

.load-fill.high {
  background: var(--danger);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 1rem;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* Utility */
.flex {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.text-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Responsive improvements */
@media (max-width: 768px) {
  body {
    padding: 0.75rem;
  }

  .container {
    padding: 0 0.5rem;
  }

  header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  nav {
    width: 100%;
    justify-content: center;
  }

  nav button {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
  }

  .flex {
    flex-direction: column;
    align-items: stretch;
  }

  .card {
    padding: 1rem;
  }

  .btn {
    width: 100%;
    padding: 0.85rem;
    font-size: 0.95rem;
  }

  .load-meter {
    flex-direction: column;
    align-items: stretch;
  }

  .load-bar {
    width: 100%;
  }

  .modal {
    padding: 1.25rem;
  }

  .modal .flex {
    flex-direction: column;
  }

  .modal .btn {
    width: 100%;
  }

  .system-menu {
    width: calc(100% - 2rem);
    right: 1rem;
    left: 1rem;
    bottom: 60px;
  }

  .system-menu .btn {
    width: 100%;
    padding: 0.85rem;
    font-size: 0.95rem;
  }

  .chart-container {
    height: 200px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.5rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .card h3 {
    font-size: 1rem;
  }

  nav button {
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
  }

  input,
  textarea,
  select {
    padding: 0.65rem;
    font-size: 0.95rem;
  }

  .btn {
    padding: 0.75rem;
    font-size: 0.9rem;
  }
}
