:root {
  color-scheme: light;
  --bg: #eef3f7;
  --panel: #ffffff;
  --text: #142033;
  --muted: #637083;
  --line: #d7e0ea;
  --blue: #2563eb;
  --green: #0f8a5f;
  --red: #b42318;
  --amber: #b7791f;
}

.remember-login { display: flex !important; align-items: center; gap: 8px; font-size: 14px; font-weight: 500 !important; color: #42566f; }
.remember-login input { width: auto !important; margin: 0; }
.batch-credentials { margin: 18px 0 24px; padding: 18px; border: 1px solid #c9d8e8; border-radius: 8px; background: #f6faff; }
.batch-credentials pre { max-height: 260px; overflow: auto; padding: 12px; border-radius: 6px; background: #102846; color: #fff; }
.account-settings-grid { align-items: start; }
.inner-panel { box-shadow: none; background: #f8fbfe; }
.batch-delete-panel { margin: 18px 0 24px; padding: 18px; border: 1px solid #f2c7c7; border-radius: 8px; background: #fff9f9; }
.batch-user-list { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 12px 0 16px; }
.batch-user-list label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.batch-user-list input { width: auto; }
.batch-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.required-setup { color: #c62828; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}
.topbar {
  min-height: 58px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #10233f;
  color: white;
}
.brand {
  color: white;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  max-width: 520px;
  line-height: 1.25;
}
nav a {
  color: #dbeafe;
  text-decoration: none;
  margin-left: 18px;
}
nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 10px 0;
}
nav a { margin-left: 0; }
.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
}
.language-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
.language-switch a.active {
  background: #ffffff;
  color: #10233f;
}
.language-switch a:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.nav-user {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}
.logout-form { margin: 0; }
.logout-form button {
  border: 0;
  background: transparent;
  color: #dbeafe;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px;
}
.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.flash {
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1e3a5f;
  padding: 11px 13px;
}
.flash.error {
  border-color: #fecaca;
  background: #fff5f5;
  color: var(--red);
}
.flash.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}
.system-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.system-panel div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.system-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
}
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.section-head h1, .panel h1 {
  margin: 0 0 6px;
  font-size: 24px;
}
.section-head p, .job-head p, .empty, .hint {
  margin: 0;
  color: var(--muted);
}
.form {
  display: grid;
  gap: 18px;
}
label {
  min-width: 0;
  overflow-wrap: anywhere;
  display: grid;
  gap: 8px;
  font-weight: 700;
}
input, select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: white;
}
input[type="file"] {
  padding: 8px;
}
.file-picker { display: flex; position: relative; align-items: center; gap: 10px; min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow: hidden; background: white; }
.file-picker .file-picker-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-picker-button { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px; background: #f1f5f9; font-size: 14px; }
.file-picker-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-picker:focus-within { outline: 2px solid #2563eb; outline-offset: 2px; }
.file-picker.is-disabled { background: #edf2f7; }
.file-picker.is-disabled .file-picker-input { cursor: not-allowed; }
.conditional-fields {
  transition: opacity .16s ease;
}
.conditional-fields.is-disabled {
  opacity: .58;
}
.conditional-fields input:disabled {
  cursor: not-allowed;
  background: #edf2f7;
}
fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  padding: 12px;
}
legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 0 6px;
}
.choice-group {
  display: grid;
  gap: 10px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}
.choice input {
  width: auto;
  margin: 0;
}
.grid-2, .grid-3 {
  display: grid;
  gap: 14px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.primary {
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: white;
  font: inherit;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
}
.secondary, .danger {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}
.danger {
  border-color: #fecaca;
  background: #fff5f5;
  color: var(--red);
}
.secondary:hover {
  border-color: #93b4f8;
  background: #eff6ff;
}
.danger:hover {
  background: #fee2e2;
}
.job-list, .file-list {
  display: grid;
  gap: 10px;
}
.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 22px;
}
.download-card {
  display: grid;
  gap: 7px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbff;
  color: var(--text);
  text-decoration: none;
}
.download-card:hover {
  border-color: #93b4f8;
  background: #eff6ff;
}
.download-card strong {
  font-size: 15px;
}
.download-card small {
  overflow-wrap: anywhere;
}
.job-row, .file-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.job-row small {
  overflow-wrap: anywhere;
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.file-list span {
  overflow-wrap: anywhere;
}
.job-row, .job-row > span { min-width: 0; }
.job-row > span { overflow-wrap: anywhere; }
.job-row > .state { flex-shrink: 0; }
.file-list small {
  white-space: nowrap;
}
.state {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}
.state.running, .state.queued { background: #dbeafe; color: #1d4ed8; }
.state.paused { background: #fef3c7; color: var(--amber); }
.state.done { background: #dcfce7; color: var(--green); }
.state.failed { background: #fee2e2; color: var(--red); }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
}
th {
  color: var(--muted);
  font-size: 13px;
}
code {
  background: #edf2f7;
  border-radius: 4px;
  padding: 2px 5px;
}
.job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}
.job-actions form {
  margin: 0;
}
.progress-grid, .metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.progress-grid div, .metrics div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}
small {
  color: var(--muted);
}
.progress-grid strong, .metrics strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.user-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin: 22px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.inline-user-form {
  display: grid;
  grid-template-columns: minmax(150px, 220px) auto;
  align-items: center;
  gap: 8px;
}
.fixed-account {
  color: var(--muted);
  font-size: 13px;
}
.table-scroll { overflow-x: auto; }

.auth-body {
  min-width: 320px;
  background: #102018;
}
.auth-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 470px);
  background-image: url("/static/chestnut-login.jpg");
  background-size: cover;
  background-position: center;
  isolation: isolate;
}
.auth-language-switch {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 24px;
  border-color: #b9c7d5;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 10px rgba(16, 35, 63, .12);
}
.auth-language-switch a {
  color: #42566f;
}
.auth-language-switch a.active {
  background: #10233f;
  color: #ffffff;
}
.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(7, 20, 13, .52);
}
.auth-intro {
  align-self: end;
  padding: 64px;
  color: #fff;
}
.auth-intro h1 {
  max-width: 720px;
  margin: 12px 0 16px;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1.08;
  letter-spacing: 0;
}
.auth-intro p { margin: 0; font-size: 17px; }
.auth-species {
  font-size: 15px !important;
  font-weight: 700;
}
.auth-panel {
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: 48px;
  background: rgba(250, 252, 250, .96);
  border-left: 1px solid rgba(255, 255, 255, .6);
}
.auth-form-wrap { width: 100%; }
.auth-form-wrap h2 {
  margin: 0 0 8px;
  font-size: 30px;
}
.auth-muted {
  margin: 0 0 26px;
  color: var(--muted);
}
.auth-form {
  display: grid;
  gap: 18px;
}
.auth-link {
  display: inline-block;
  margin-top: 20px;
  color: #175f47;
  font-weight: 700;
  text-decoration: none;
}
.photo-credit {
  position: absolute;
  left: 18px;
  bottom: 14px;
  display: grid;
  gap: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
}
.photo-credit a { color: #fff; }
@media (max-width: 880px) {
  .layout, .grid-2, .grid-3, .progress-grid, .metrics, .download-grid, .system-panel, .user-create-form {
    grid-template-columns: 1fr;
  }
  .page { padding: 16px; }
  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 16px;
    gap: 12px;
  }
  .brand { max-width: 55%; font-size: 15px; }
  nav { flex-wrap: wrap; justify-content: flex-end; }
  .auth-shell { grid-template-columns: 1fr; align-content: end; }
  .auth-intro {
    align-self: auto;
    padding: 38px 24px 26px;
  }
  .auth-intro h1 { font-size: 38px; }
  .auth-panel {
    min-height: auto;
    padding: 32px 24px 54px;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, .6);
  }
  .auth-language-switch { top: 14px; right: 14px; }
  .photo-credit { bottom: 12px; }
}
