:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --red: #e5484d;
  --yellow: #f5c518;
  --good: #2fb170;
  --bad: #e5484d;
}

* { box-sizing: border-box; }

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

main {
  max-width: 880px;
  margin: 0 auto;
}

.layout {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  max-width: 1240px;
  margin: 0 auto;
}
.layout main { margin: 0; flex: 1; min-width: 0; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.sidebar .brand { font-weight: 700; font-size: 1.05rem; }
.sidebar-title { font-size: 1rem; margin-top: 1.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.sidebar-title:first-child { margin-top: 0; }
.sidebar table { font-size: 0.85rem; }
.code-cell { font-weight: 600; letter-spacing: 0.05em; }

.nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}
.nav a:hover { background: #1f2430; }
.nav a.active { background: var(--accent); color: white; font-weight: 600; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 0.9rem; }

.stats-grid { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat { flex: 1; min-width: 140px; text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.2rem; }

.code-input {
  font-size: 1.4rem;
  letter-spacing: 0.3rem;
  text-align: center;
  text-transform: uppercase;
}

h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.1rem; margin-top: 2.5rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
p.subtitle { color: var(--muted); margin-top: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; margin-top: 0.9rem; }
input[type="text"], input[type="number"], select, input[type="file"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: #0f1115;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
}

button {
  margin-top: 1.1rem;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.danger { background: var(--bad); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.pending { background: #333; color: #ccc; }
.badge.queued { background: #1a2a3a; color: #6cb0e0; }
.badge.running { background: #3a3400; color: var(--yellow); }
.badge.finished { background: #103b26; color: var(--good); }
.badge.failed { background: #3b1414; color: var(--bad); }

.msg { margin-top: 1rem; padding: 0.7rem 0.9rem; border-radius: 6px; font-size: 0.9rem; }
.msg.error { background: #3b1414; color: #ffb4b4; }
.msg.success { background: #103b26; color: #a7f0c9; }

a { color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.small { font-size: 0.8rem; color: var(--muted); }

.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.link-button {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}
