:root {
  --ink: #17211d;
  --muted: #66736d;
  --paper: #f7f5ef;
  --surface: #fffdf7;
  --line: #d9d4c7;
  --green: #176b4c;
  --green-dark: #0f5038;
  --amber: #b26a00;
  --red: #a33b35;
  --red-dark: #762b27;
  --shadow: 0 18px 50px rgba(29, 35, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 107, 76, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(23, 107, 76, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 38px 0;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px;
  align-items: center;
  min-height: calc(100vh - 76px);
}

.brand-panel {
  border-left: 5px solid var(--green);
  padding-left: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: white;
  outline: none;
}

.field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 76, 0.16);
}

.primary-button,
.danger-button,
.ghost-button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: white;
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  background: var(--green);
  box-shadow: 0 10px 24px rgba(23, 107, 76, 0.22);
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.danger-button {
  background: var(--red);
  box-shadow: 0 10px 24px rgba(163, 59, 53, 0.18);
}

.danger-button:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.primary-button:disabled,
.danger-button:disabled,
.ghost-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 253, 247, 0.8);
}

.ghost-button:hover {
  border-color: var(--green);
}

.compact {
  min-width: 92px;
}

.text-link {
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.flash-stack {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 10;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 36px));
  transform: translateX(-50%);
}

.flash {
  border-radius: 6px;
  padding: 12px 14px;
  color: white;
  box-shadow: var(--shadow);
  transition: opacity 220ms ease, transform 220ms ease;
}

.flash.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.flash-success {
  background: var(--green);
}

.flash-error {
  background: var(--red);
}

.dashboard {
  display: grid;
  gap: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  display: grid;
  align-content: start;
  min-height: 156px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 12px 34px rgba(29, 35, 31, 0.08);
}

.metric-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.metric small {
  align-self: end;
  color: var(--muted);
  line-height: 1.6;
}

.metric-number {
  margin: 18px 0 10px;
  font-size: clamp(46px, 7vw, 76px);
  line-height: 0.9;
  letter-spacing: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 42px;
  margin: 22px 0 20px;
  border-radius: 6px;
  padding: 0 12px;
  color: white;
  font-weight: 900;
}

.status-idle {
  background: #606b66;
}

.status-running {
  background: var(--green);
}

.status-paused {
  background: var(--amber);
}

.status-completed {
  background: #285f8f;
}

.status-error {
  background: var(--red);
}

.status-processing {
  background: var(--amber);
}

.controls {
  gap: 20px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.button-row form {
  margin: 0;
}

.error-band {
  border-left: 5px solid var(--red);
  padding: 14px 18px;
  background: rgba(163, 59, 53, 0.09);
  color: var(--red-dark);
  font-weight: 800;
}

.log-section {
  display: grid;
  gap: 16px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(29, 35, 31, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
}

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

@media (max-width: 820px) {
  .auth-layout,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    align-content: center;
    gap: 28px;
  }

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

  .ghost-button {
    width: 100%;
  }
}
