:root {
  --bg: #0b0c10;
  --card: #151820;
  --text: #e6edf3;
  --muted: #9aa7b3;
  --accent: #4f9cff;
  --border: #242837;
}

/* Light theme variables */
:root[data-theme="light"] {
  --bg: #ffffff;
  --card: #f8fafc;
  --text: #1a202c;
  --muted: #64748b;
  --accent: #3b82f6;
  --border: #e2e8f0;
}

/* Dark theme variables (explicit for clarity) */
:root[data-theme="dark"] {
  --bg: #0b0c10;
  --card: #151820;
  --text: #e6edf3;
  --muted: #9aa7b3;
  --accent: #4f9cff;
  --border: #242837;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
.container {
  max-width: 920px; margin: 0 auto; padding: 32px 16px;
}
h1 { margin: 0 0 8px; font-size: 24px; }
.sub { margin: 0 0 16px; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}

fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
legend { color: var(--muted); padding: 0 6px; }

.grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: #0f1117; color: var(--text);
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row select { width: auto; min-width: 120px; }
.muted { color: var(--muted); font-size: 12px; display: inline-block; min-width: 120px; }
#slp-totals-card { text-align: right; }
.totals-grid { display: inline-grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; justify-items: end; }
.totals-grid span { display: inline-block; min-width: 120px; text-align: right; font-variant-numeric: tabular-nums; }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
button {
  background: var(--accent); color: #08101a; font-weight: 600; border: none; border-radius: 8px;
  padding: 10px 14px; cursor: pointer;
}
button[disabled] { opacity: 0.7; cursor: wait; }

#status { color: var(--muted); font-size: 13px; }

details { cursor: pointer; }
.help { color: var(--muted); }

footer { color: var(--muted); margin-top: 16px; font-size: 12px; }

/* Link-styled button for sample downloads */
.link-btn {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 0;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.disabled {
  color: #6a7785;
  pointer-events: none;
}

/* Visibility helpers */
.hidden { display: none !important; }

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  background: var(--accent);
  color: var(--bg);
  transform: scale(1.1);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Smooth transitions for theme changes */
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Light theme specific adjustments */
:root[data-theme="light"] input,
:root[data-theme="light"] select {
  background: #ffffff;
  border-color: var(--border);
}

:root[data-theme="light"] button {
  color: #ffffff;
}
