:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2e38;
  --text: #e6e8eb;
  --muted: #9aa1ac;
  --accent: #4f8cff;

  /* Card accent palette -- cycled per dashboard card so the homepage
     doesn't read as one flat block once more dashboards ship. */
  --accent-blue: #4f8cff;
  --accent-violet: #9b6bff;
  --accent-teal: #2dd4bf;
  --accent-coral: #ff8a65;
  --accent-pink: #f472b6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  padding: 2rem 1.5rem 1rem;
  max-width: 960px;
  margin: 0 auto;
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

header .accent-text {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

header p {
  margin: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.upload-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.upload-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.upload-cta:active {
  transform: translateY(0);
}

/* Visible focus ring: this is the one destructive action on the site, so it
   should never be ambiguous which control is about to be activated. */
.upload-cta:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.build-picker {
  margin: 1.5rem 0 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.build-picker legend {
  padding: 0 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.build-picker label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.build-picker input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.build-note {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #f0b429;
}

.build-note[hidden] {
  display: none;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

/* The nav bar. Rendered by /nav.js from the one dashboard list, with plain
   links in the markup as the fallback -- so these rules have to dress both the
   <a> and the <button> that opens the menu identically. */
nav.top-links {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Immediately after the bar, the header's usual 2rem of head-room reads as a
   gap rather than a margin. */
nav.top-links + header {
  padding-top: 1.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease,
    transform 0.14s ease;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--accent-blue);
  background: rgba(79, 140, 255, 0.1);
  transform: translateY(-1px);
}

.nav-link:active {
  transform: translateY(0);
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.nav-menu {
  position: relative;
  display: inline-flex;
}

.nav-menu-btn[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--accent-blue);
  background: rgba(79, 140, 255, 0.1);
}

.nav-chevron {
  transition: transform 0.16s ease;
}

.nav-menu-btn[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-menu-list {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  /* Above the sticky table headers on the dashboard pages, which sit at 1. */
  z-index: 50;
  min-width: 232px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 38px -18px rgba(0, 0, 0, 0.85);
  animation: menu-in 0.14s ease both;
}

.nav-menu-list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  color: var(--text);
  font-size: 0.86rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s ease;
}

.nav-menu-list a:hover {
  background: rgba(79, 140, 255, 0.12);
}

.nav-menu-list a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: -2px;
}

/* The dashboard you're already looking at. */
.nav-menu-list a[aria-current="page"] {
  background: rgba(79, 140, 255, 0.08);
  font-weight: 600;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dashboard-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-card {
  /* --card-accent is set inline per card (see index.html) so cards cycle
     through the palette; this is just the fallback. */
  --card-accent: var(--accent-blue);
  animation: card-in 0.35s ease both;
}

.dashboard-card a {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  padding: 1.1rem 1.25rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dashboard-card a:hover {
  transform: translateY(-3px);
  border-color: var(--card-accent);
  box-shadow: 0 10px 24px -12px var(--card-accent);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card-accent);
  flex-shrink: 0;
}

.card-status {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dashboard-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.card-desc {
  margin: 0;
  flex-grow: 1;
  font-size: 0.85rem;
  color: var(--muted);
}

.card-arrow {
  align-self: flex-end;
  color: var(--card-accent);
  font-size: 1.1rem;
  transition: transform 0.15s ease;
}

.dashboard-card a:hover .card-arrow {
  transform: translateX(4px);
}

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

.dropzone {
  margin-top: 1.5rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2.75rem 1.5rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.dropzone:hover {
  border-color: var(--accent-violet);
  transform: translateY(-2px);
}

.dropzone.dragover {
  border-color: var(--accent-blue);
  background: rgba(79, 140, 255, 0.08);
  transform: scale(1.015);
  box-shadow: 0 12px 32px -16px var(--accent-blue);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--border);
}

.dropzone-icon {
  color: var(--accent);
  margin-bottom: 0.5rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

.dropzone:hover .dropzone-icon {
  transform: translateY(-3px);
  color: var(--accent-violet);
}

.dropzone.dragover .dropzone-icon {
  transform: translateY(-5px) scale(1.08);
  color: var(--accent-blue);
}

@keyframes icon-spin-once {
  from {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.15);
  }
  to {
    transform: rotate(360deg) scale(1);
  }
}

.dropzone-icon.spin-once {
  animation: icon-spin-once 0.5s ease;
}

#dropzone-label {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.dropzone-or {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
}

.choose-btn {
  position: relative;
  z-index: 1;
  padding: 0.55rem 1.4rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.choose-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px var(--accent-violet);
}

.choose-btn:active {
  transform: translateY(0);
}

.dropzone input[type="file"] {
  display: none;
}

@keyframes chip-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--text);
  animation: chip-in 0.2s ease both;
}

.file-chip-size {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.progress-track {
  margin-top: 1rem;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  background-size: 200% 100%;
  animation: progress-shimmer 1.2s linear infinite;
  transition: width 0.15s ease;
}

@keyframes progress-shimmer {
  from {
    background-position: 0% 0%;
  }
  to {
    background-position: -200% 0%;
  }
}

@keyframes success-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.4);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(45, 212, 191, 0);
  }
}

.dropzone.success-pulse {
  animation: success-flash 0.6s ease;
}

/* Scoped to a class, NOT #status -- the dashboard pages use that same id
   for their own "Loading…" box, and an author-level `display` here
   overrides the browser's `[hidden] { display: none }`, which silently
   breaks `el.hidden = true` on those pages. */
.upload-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.5rem;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.status-spinner {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  flex-shrink: 0;
  animation: spinner-rotate 0.6s linear infinite;
}

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

.upload-status.ok {
  color: #4fdb8f;
}

.upload-status.ok .status-icon {
  background: rgba(79, 219, 143, 0.15);
  color: #4fdb8f;
}

.upload-status.error {
  color: #ff6b6b;
}

.upload-status.error .status-icon {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

.upload-status.busy {
  color: var(--muted);
}

/* Belt and braces: keep `el.hidden = true` working even if some future
   rule sets an explicit `display` on the same element. */
[hidden] {
  display: none !important;
}
