:root {
  color-scheme: light;
  --navy: #10243f;
  --blue: #1769e0;
  --blue-dark: #0c52bb;
  --ink: #172033;
  --muted: #667085;
  --line: #dde3ec;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --success: #067647;
  --error: #b42318;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: inherit; }
button, input { font: inherit; }

.site-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1180px) / 2));
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--navy);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; }

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 42px 24px 72px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.035em; line-height: 1.08; margin-bottom: 12px; }
h2 { font-size: 23px; letter-spacing: -0.02em; margin-bottom: 6px; }

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.hero-row, .panel-heading, .hero-actions, .form-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.hero-row { gap: 28px; margin-bottom: 30px; }
.hero-row p:not(.eyebrow), .panel-heading p { color: var(--muted); margin-bottom: 0; }
.hero-actions, .form-actions { gap: 10px; }

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 44px;
  padding: 10px 17px;
  text-decoration: none;
}

.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-dark); }
.button-primary:disabled { cursor: not-allowed; opacity: .55; }
.button-secondary { background: #fff; border-color: var(--line); color: var(--ink); }

.link-button, .text-link, .back-link {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 24px;
}

.stat-card, .panel, .form-card, .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(16, 36, 63, .05);
}

.stat-card { padding: 22px; }
.stat-card span { color: var(--muted); display: block; font-size: 13px; margin-bottom: 7px; }
.stat-card strong { font-size: 28px; }
.stat-card strong.stat-time { font-size: 18px; line-height: 1.35; }
.stat-card small { color: var(--muted); display: block; font-size: 12px; margin-top: 7px; }
.status-ok, .text-success { color: var(--success); }
.status-running { color: var(--blue); }
.text-error { color: var(--error); }

.panel { overflow: hidden; }
.panel-heading { padding: 24px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 760px; width: 100%; }
th, td { border-top: 1px solid var(--line); padding: 16px 24px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 3px; max-width: 480px; }
.align-right { text-align: right; }
.muted { color: var(--muted); }

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}
.badge-active { background: #ecfdf3; color: var(--success); }
.badge-paused { background: #f2f4f7; color: #475467; }

.notice {
  border-radius: 10px;
  margin-bottom: 18px;
  padding: 12px 15px;
}
.notice-success { background: #ecfdf3; color: var(--success); }
.notice-error { background: #fef3f2; color: var(--error); }

.login-card, .form-card {
  margin: 5vh auto 0;
  max-width: 650px;
  padding: clamp(26px, 5vw, 48px);
}
.login-card { max-width: 480px; }
.login-card > p:not(.eyebrow), .form-card label small { color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 30px; }

.form-stack { display: grid; gap: 18px; margin-top: 28px; }
.form-stack label { display: grid; font-size: 14px; font-weight: 750; gap: 7px; }
.form-stack label small { font-size: 12px; font-weight: 500; }
.form-stack input {
  background: #fff;
  border: 1px solid #cbd3df;
  border-radius: 10px;
  color: var(--ink);
  min-height: 46px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}
.form-stack input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 105, 224, .13); }
.form-stack input[readonly] { background: #f2f4f7; color: var(--muted); }
.checkbox-row { align-items: center; display: flex !important; grid-template-columns: 20px 1fr; }
.checkbox-row input { min-height: auto; width: 18px; }
.form-actions { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 22px; }
.empty-state { color: var(--muted); padding: 52px 24px; text-align: center; }
.compact-back-link { margin-bottom: 16px; }
.log-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.log-panel { overflow: hidden; }
.log-output {
  background: #0b1424;
  border-top: 1px solid var(--line);
  color: #e6edf7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  margin: 0;
  max-height: 62vh;
  min-height: 360px;
  overflow: auto;
  padding: 22px 24px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 760px) {
  .site-header { padding-inline: 18px; }
  .page { padding: 30px 16px 56px; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .hero-actions { width: 100%; }
  .hero-actions > *, .hero-actions form, .hero-actions button { flex: 1; width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .log-stats { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
}
