:root {
  color-scheme: dark;
  --bg: #0b1018;
  --sidebar: #0f1724;
  --sidebar-active: #172235;
  --panel: #111827;
  --panel-soft: #151f2e;
  --panel-muted: #0d1420;
  --ink: #e5edf7;
  --heading: #f8fafc;
  --muted: #8b9aaf;
  --line: #243244;
  --line-soft: #1c2736;
  --primary: #2f81f7;
  --primary-hover: #1f6feb;
  --success: #2ea043;
  --warning: #d29922;
  --danger: #f85149;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.admin-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px;
  border-right: 1px solid var(--line-soft);
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #ffffff;
  background: var(--primary);
  font-size: 19px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--heading);
  font-size: 15px;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  color: #b6c2d2;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover {
  color: #ffffff;
  background: #131e2d;
}

.nav-item.active {
  border-color: #2a3a50;
  color: #ffffff;
  background: var(--sidebar-active);
}

.side-note {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #101a28;
}

.side-note strong,
.side-note span {
  display: block;
}

.side-note strong {
  color: var(--heading);
  font-size: 13px;
}

.side-note span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.main {
  min-width: 0;
  padding: 22px 24px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.settings-form {
  display: grid;
  grid-template-columns: 112px 190px auto;
  gap: 8px;
}

.settings-form input,
.settings-form button {
  min-height: 38px;
}

.settings-form button {
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: #7aa7e8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--heading);
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metrics article,
.panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--heading);
  font-size: 25px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-col {
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(300px, 0.7fr) minmax(380px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.verify-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

label {
  display: grid;
  gap: 7px;
  color: #c8d3df;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #0b1220;
  font-weight: 600;
}

input {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 170px;
  resize: vertical;
  padding: 11px;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: #6b7b90;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(47, 129, 247, 0.18);
}

button,
.download {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 15px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

button:hover,
.download:hover {
  background: var(--primary-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.download.disabled {
  pointer-events: auto;
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.25);
}

.secondary,
.secondary-link {
  color: #dbe7f5;
  background: #263448;
}

.secondary-link:hover,
.secondary:hover {
  background: #304057;
}

.ghost {
  border: 1px solid var(--line);
  color: #dbe7f5;
  background: transparent;
}

.ghost:hover {
  background: #172235;
}

.danger {
  min-height: 32px;
  color: #ffd4d1;
  background: rgba(248, 81, 73, 0.16);
}

.danger:hover {
  color: #ffffff;
  background: var(--danger);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.account-list,
.task-account-list {
  display: grid;
  gap: 10px;
}

.task-account-list {
  max-height: 230px;
  overflow: auto;
}

.account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 12px;
  background: var(--panel-soft);
}

.account-card.compact {
  grid-template-columns: 1fr;
}

.account-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-main input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--primary);
}

.account-main strong,
.account-main small {
  display: block;
}

.account-main strong {
  overflow: hidden;
  color: var(--heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-main small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.status.ok,
.yes {
  color: #7ee787;
  background: rgba(46, 160, 67, 0.16);
}

.status.warn {
  color: #f2cc60;
  background: rgba(210, 153, 34, 0.16);
}

.status.run {
  color: #79c0ff;
  background: rgba(47, 129, 247, 0.16);
}

.status.bad,
.no {
  color: #ff9b95;
  background: rgba(248, 81, 73, 0.16);
}

.file-drop {
  min-height: 138px;
  grid-column: 1 / -1;
  place-items: center;
  border: 1px dashed #334966;
  border-radius: 8px;
  padding: 18px;
  color: #dbe7f5;
  background: #0d1624;
  cursor: pointer;
  text-align: center;
}

.source-tabs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px;
  background: #0b1220;
}

.source-tab {
  min-height: 34px;
  border: 0;
  color: #aebccc;
  background: transparent;
}

.source-tab:hover {
  background: #172235;
}

.source-tab.active {
  color: #ffffff;
  background: #263448;
}

.paste-box {
  grid-column: 1 / -1;
}

.paste-box small,
.file-drop small {
  color: var(--muted);
  font-weight: 600;
}

.file-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.file-drop strong,
.file-drop small {
  display: block;
}

.file-drop strong {
  font-size: 17px;
}

.file-drop small {
  margin-top: 6px;
}

.selected-box,
.progress-card {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 14px;
  background: var(--panel-soft);
}

.selected-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.selected-box span,
.auto-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.selected-box strong {
  color: var(--heading);
  font-size: 26px;
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line-soft);
}

.auto-summary {
  display: grid;
  gap: 10px;
}

.auto-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 12px;
  background: var(--panel-soft);
}

.auto-summary strong {
  color: var(--heading);
  text-align: right;
}

.estimate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.run-monitor {
  min-height: 520px;
}

.job-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: #aebccc;
  background: #253247;
  font-size: 12px;
  font-weight: 800;
}

.job-badge.running {
  color: #79c0ff;
  background: rgba(47, 129, 247, 0.16);
}

.job-badge.completed {
  color: #7ee787;
  background: rgba(46, 160, 67, 0.16);
}

.job-badge.failed {
  color: #ff9b95;
  background: rgba(248, 81, 73, 0.16);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-meta strong {
  color: var(--heading);
}

.progress-bar {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #263448;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
}

.log-console {
  height: 330px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: #090f19;
  color: #d6e2f0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.log-line {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}

.log-line time {
  flex: 0 0 auto;
  color: #79c0ff;
}

.log-line.muted {
  color: #7b8798;
}

.results-panel {
  min-height: 560px;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel-muted);
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #b9c7d8;
  background: #151f2e;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: #131d2b;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty,
.empty-card {
  color: var(--muted);
  text-align: center;
}

.empty {
  height: 260px;
}

.empty-card {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 34px 14px;
  background: var(--panel-soft);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 7, 18, 0.72);
}

.modal-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-form {
  grid-template-columns: 1fr;
}

.modal-state {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #0d1624;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.5;
}

.modal-state.success {
  border-color: rgba(46, 160, 67, 0.45);
  color: #7ee787;
  background: rgba(46, 160, 67, 0.12);
}

.modal-state.warning {
  border-color: rgba(210, 153, 34, 0.45);
  color: #f2cc60;
  background: rgba(210, 153, 34, 0.12);
}

.modal-state.error {
  border-color: rgba(248, 81, 73, 0.5);
  color: #ff9b95;
  background: rgba(248, 81, 73, 0.12);
}

@media (max-width: 1400px) {
  .workbench {
    grid-template-columns: 1fr 1fr;
  }

  .run-monitor {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-note {
    display: none;
  }

  .two-col,
  .workbench,
  .metrics {
    grid-template-columns: 1fr;
  }

  .run-monitor {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
  }

  .top-actions,
  .settings-form {
    width: 100%;
  }

  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .estimate-grid,
  .account-card {
    grid-template-columns: 1fr;
  }
}
