:root {
  color-scheme: dark;
  --ink: #f7f7f7;
  --muted: #a3a3a3;
  --line: #2b2b2b;
  --bg: #050505;
  --panel: #0e0e0e;
  --field: #000000;
  --accent: #22c55e;
  --accent-strong: #86efac;
  --danger: #ff8a80;
  --success: #86efac;
  --warning: #f5d06f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
body > main { flex: 1; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.1rem; }
h3 { margin-top: 0; }
a { color: var(--accent); }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
input, select, textarea, button, .button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.72rem 0.8rem;
  font: inherit;
}
input, select, textarea {
  background: var(--field);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #737373; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(34, 197, 94, 0.28);
  outline-offset: 1px;
}
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-color: var(--accent);
  background: var(--accent);
  color: #021006;
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
}
button:disabled, .button.is-loading { cursor: wait; opacity: 0.78; }
.secondary { background: #000000; color: var(--accent); }
.danger { border-color: var(--danger); color: var(--danger); }
.stack { display: grid; gap: 1rem; }
.auth-shell, .upload-shell {
  min-height: calc(100vh - 82px);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.auth-panel, .upload-panel, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
.auth-panel { width: min(100%, 390px); padding: 1.5rem; }
.upload-panel { width: min(100%, 680px); padding: 1.5rem; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
}
.auth-brand { margin-bottom: 2.3rem; }
.auth-heading { margin-bottom: 1.4rem; }
.auth-heading h1 { margin-bottom: 0.55rem; }
.auth-heading > p:last-child { color: var(--muted); line-height: 1.55; }
.back-link { display: inline-block; margin-top: 1.2rem; color: var(--muted); font-size: 0.9rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  background: #000000;
  border-bottom: 1px solid var(--line);
}
.topbar p { color: var(--muted); margin-bottom: 0; }
.topbar form, .topbar button { width: auto; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
}
.panel { padding: 1rem; min-width: 0; }
.wide { grid-column: 1 / -1; }
.copy-row, .inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}
.copy-row .button, .inline-form button { width: auto; min-width: 88px; }
.secret-code-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
}
.secret-code-form label { display: grid; gap: 0.4rem; }
.secret-code-form button { width: auto; min-width: 112px; }
.help-text { color: var(--muted); margin: 0.65rem 0 0; font-size: 0.9rem; }
.manage-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.manage-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}
.manage-list form, .manage-list button { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1080px; }
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.83rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.actions form, .actions .button, .actions button { width: auto; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; }
.left { text-align: left; margin: 0; }
.alert, .success {
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.alert {
  border: 1px solid rgba(255, 143, 126, 0.35);
  background: rgba(120, 30, 24, 0.34);
  color: var(--danger);
}
.success {
  border: 1px solid rgba(113, 217, 159, 0.35);
  background: rgba(21, 97, 48, 0.32);
  color: var(--success);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.8rem;
  margin: 0;
}
legend { color: var(--muted); padding: 0 0.35rem; }
.check-list { display: grid; gap: 0.45rem; }
.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.check-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}
.file-selection {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000000;
}
.file-selection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
}
.file-selection-header button {
  width: auto;
  min-width: 74px;
  padding: 0.48rem 0.7rem;
}
.selected-files {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.selected-files li {
  overflow-wrap: anywhere;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
}
.loading-status {
  display: none;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid rgba(34, 197, 94, 0.36);
  border-radius: 6px;
  background: rgba(21, 97, 48, 0.28);
  color: var(--accent-strong);
  line-height: 1.4;
}
.is-loading .loading-status { display: flex; }
.spinner {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.is-loading button[type="submit"]::before,
.button.is-loading::before {
  content: "";
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.security-warning {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(243, 191, 103, 0.42);
  border-radius: 8px;
  background: rgba(93, 65, 24, 0.4);
  color: var(--warning);
  line-height: 1.45;
}
.auth-panel .security-warning { margin-bottom: 1rem; }
.security-warning code {
  font-size: 0.92em;
  background: rgba(243, 191, 103, 0.12);
  border-radius: 4px;
  padding: 0.08rem 0.22rem;
}

/* Public developer documentation */
.docs-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem max(1.25rem, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(14px);
}
.docs-nav nav { display: flex; align-items: center; gap: 1.5rem; }
.docs-nav nav > a:not(.button) { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.docs-nav .button { width: auto; padding: 0.55rem 0.8rem; }
.docs-shell { width: min(calc(100% - 2.5rem), 1120px); margin: 0 auto; }
.docs-hero {
  min-height: 660px;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  align-items: center;
  gap: clamp(2rem, 8vw, 7rem);
  padding: 6rem 0;
}
.eyebrow {
  margin-bottom: 0.8rem;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.docs-hero h1 { max-width: 780px; margin-bottom: 1.4rem; font-size: clamp(2.7rem, 6vw, 5.6rem); line-height: 0.98; letter-spacing: -0.055em; }
.hero-copy { max-width: 690px; color: var(--muted); font-size: 1.15rem; line-height: 1.7; }
.hero-actions { display: flex; gap: 0.75rem; margin-top: 2rem; }
.hero-actions .button { width: auto; min-width: 130px; }
.hero-mark { display: grid; gap: 1rem; color: var(--muted); font-size: 0.8rem; text-align: center; }
.hero-mark img { width: 100%; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 80px rgba(34, 197, 94, 0.12); }
.docs-section { padding: 6rem 0; border-top: 1px solid var(--line); scroll-margin-top: 68px; }
.section-intro { max-width: 680px; margin-bottom: 2.5rem; }
.section-intro h2 { margin-bottom: 0.8rem; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; letter-spacing: -0.04em; }
.section-intro > p:last-child { color: var(--muted); line-height: 1.7; }
.code-panel, .deploy-grid > div { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #090909; }
.code-title { display: flex; justify-content: space-between; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; }
pre { overflow-x: auto; margin: 0; padding: 1.25rem; color: #d4d4d4; font-size: 0.9rem; line-height: 1.75; }
.callout { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; margin-top: 1rem; padding: 1rem; border-left: 2px solid var(--accent); background: rgba(34, 197, 94, 0.07); }
.callout span, .docs-note { color: var(--muted); }
.step-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.step-grid article { min-height: 220px; padding: 1.4rem; border: 1px solid var(--line); border-right: 0; }
.step-grid article:last-child { border-right: 1px solid var(--line); }
.step-number { display: block; margin-bottom: 3.5rem; color: var(--accent); font: 0.78rem "SFMono-Regular", Consolas, monospace; }
.step-grid p, .feature-grid p { color: var(--muted); line-height: 1.6; }
.config-list { border-top: 1px solid var(--line); }
.config-list > div { display: grid; grid-template-columns: minmax(220px, 0.4fr) 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.config-list span { color: var(--muted); }
.deploy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.deploy-grid h3 { margin: 0; padding: 1rem 1.25rem 0; }
.docs-note { margin: 1.25rem 0 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature-grid article { padding: 1.4rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.site-footer {
  flex: 0 0 auto;
  width: min(calc(100% - 2.5rem), 1120px);
  margin: 0 auto;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-footer a { color: var(--muted); font-size: 0.85rem; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--accent-strong); text-decoration: underline; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .copy-row, .inline-form, .secret-code-form { grid-template-columns: 1fr; }
  .copy-row .button, .inline-form button, .secret-code-form button { width: 100%; }
  .docs-nav nav > a:not(.button) { display: none; }
  .docs-nav nav > .repo-link { display: inline; }
  .docs-hero { min-height: auto; grid-template-columns: 1fr; padding: 4rem 0; }
  .docs-hero h1 { font-size: clamp(2.7rem, 14vw, 4.5rem); }
  .hero-mark { width: min(75%, 320px); margin: 1rem auto 0; }
  .docs-section { padding: 4rem 0; }
  .step-grid, .deploy-grid, .feature-grid { grid-template-columns: 1fr; }
  .step-grid article { min-height: 0; border-right: 1px solid var(--line); border-bottom: 0; }
  .step-grid article:last-child { border-bottom: 1px solid var(--line); }
  .step-number { margin-bottom: 2rem; }
  .config-list > div, .callout { grid-template-columns: 1fr; }
}
