:root {
  --bg: #081523;
  --bg-deep: #06111d;
  --panel: #0d1c2e;
  --panel-soft: #12263a;
  --input: #081626;
  --line: #244159;
  --line-soft: rgba(131, 174, 207, 0.18);
  --text: #f3f7fb;
  --muted: #8cb5d5;
  --accent: #19c8c5;
  --accent-dark: #0b6d76;
  --blue: #4da2ff;
  --danger: #ff8096;
  --radius: 8px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 0; }

body {
  margin: 0;
  min-width: 0;
  color: var(--text);
  background: linear-gradient(180deg, #0a2235 0, var(--bg) 42%, var(--bg-deep) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 18px;
  color: #041319;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
}

a { color: #6fc4ff; }

code {
  font-family: Consolas, "Courier New", monospace;
  color: #9fd5ff;
}

.workspace {
  width: min(1460px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.page-header,
.section-heading,
.form-footer,
.header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.page-header {
  min-height: 92px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 { font-size: 34px; }
h2 { font-size: 23px; }

.page-description {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.header-actions { flex-wrap: wrap; }

.tab-bar {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 14px 20px;
}

.tab-button.is-active {
  color: var(--accent);
  background: rgba(25, 200, 197, 0.12);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.tab-panel {
  display: none;
  min-width: 0;
  padding-top: 22px;
}

.tab-panel.is-active {
  display: grid;
  gap: 18px;
}

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

.summary-card,
.tool-panel,
.data-section,
.config-card,
.job-detail {
  min-width: 0;
  background: rgba(13, 28, 46, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-card { padding: 19px; }

.summary-label,
.section-kicker,
.config-key,
label > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-value {
  margin-top: 9px;
  font-size: 36px;
  font-weight: 800;
}

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

.tool-panel,
.data-section {
  padding: 24px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-top: 8px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

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

label { min-width: 0; }

label > span {
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(25, 200, 197, 0.12);
}

textarea {
  min-height: 106px;
  resize: vertical;
}

input[type="file"] {
  padding: 9px;
}

.feedback {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.status-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  padding: 6px 9px;
  font-size: 12px;
}

.status-chip {
  color: #9debe6;
  background: rgba(25, 200, 197, 0.12);
}

.status-pill.queued { color: #ffd39f; background: rgba(255, 180, 84, 0.14); }
.status-pill.running { color: #92c7ff; background: rgba(77, 162, 255, 0.14); }
.status-pill.succeeded,
.status-pill.active { color: #abfadd; background: rgba(123, 240, 200, 0.14); }
.status-pill.failed { color: #ffc4ce; background: rgba(255, 122, 144, 0.14); }
.status-pill.verification_required { color: #ffd39f; background: rgba(255, 180, 84, 0.16); }
.status-pill.disabled { color: #c7d4e2; background: rgba(255, 255, 255, 0.08); }

.table-shell {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--muted);
  font-weight: 600;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.is-active {
  background: rgba(77, 162, 255, 0.07);
}

.muted-text {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.balance-value {
  color: #baf578;
  font-variant-numeric: tabular-nums;
}

.proxy-value {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  gap: 7px;
}

.table-actions button {
  padding: 7px 9px;
  font-size: 12px;
}

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

.config-card {
  padding: 17px;
}

.config-value {
  margin-top: 9px;
  overflow-wrap: anywhere;
  color: #d8e8f5;
}

.code-block {
  margin: 13px 0 0;
  max-width: 100%;
  padding: 13px;
  overflow: auto;
  color: #d8e8f5;
  background: var(--input);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.logs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.job-detail {
  padding: 17px;
}

.detail-body {
  margin-top: 10px;
  color: #b7cede;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  font-size: 13px;
}

.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell { width: min(100%, 460px); }

.login-card {
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.hero-mark {
  display: inline-flex;
  padding: 7px 10px;
  color: #9fd5ff;
  background: rgba(77, 162, 255, 0.12);
  border-radius: var(--radius);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-tip,
.login-error {
  margin-top: 15px;
  color: var(--muted);
  font-size: 13px;
}

.login-error { color: var(--danger); }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-grid,
  .logs-layout { grid-template-columns: minmax(0, 1fr); }
  .job-detail { width: 100%; }
}

@media (max-width: 700px) {
  .workspace {
    width: min(100% - 24px, 1460px);
    padding-top: 16px;
  }
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
  h1 { font-size: 28px; }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1 1 auto; }
  .tab-bar { overflow-x: auto; }
  .tab-button { white-space: nowrap; }
  .summary-grid,
  .form-grid,
  .config-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-panel,
  .data-section { padding: 17px; }
}
