:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #151820;
  --muted: #6b7280;
  --line: #e6e8ec;
  --blue: #0b69ff;
  --blue-dark: #0758d6;
  --green: #16a36a;
  --red: #d83a52;
  --violet: #8a42e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.brand span { color: var(--blue); }
.topbar nav { display: flex; align-items: center; gap: 28px; color: #414651; font-size: 14px; font-weight: 650; }
.topbar nav a:hover { color: var(--blue); }
.runtime-indicator {
  min-height: 30px;
  padding: 5px 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dfe3e9;
  border-radius: 16px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.runtime-dot { width: 7px; height: 7px; border-radius: 50%; background: #8d95a2; }
.runtime-indicator.running, .runtime-indicator.pending {
  border-color: #bfd4ff;
  background: #edf3ff;
  color: var(--blue);
}
.runtime-indicator.running .runtime-dot,
.runtime-indicator.pending .runtime-dot {
  background: var(--blue);
  box-shadow: 0 0 0 3px #d9e7ff;
  animation: runtime-pulse 1.5s infinite;
}
.runtime-indicator.captcha {
  border-color: #f4bd72;
  background: #fff4df;
  color: #a95800;
  font-weight: 800;
}
.runtime-indicator.captcha .runtime-dot {
  background: #e17800;
  box-shadow: 0 0 0 3px #ffe2b8;
  animation: runtime-pulse 1s infinite;
}
.runtime-indicator.background {
  border-color: #b7ddd5;
  background: #eaf8f5;
  color: #15745f;
  font-weight: 750;
}
.runtime-indicator.background .runtime-dot {
  background: #1a987a;
  box-shadow: 0 0 0 3px #ccece5;
  animation: runtime-pulse 1.5s infinite;
}
.runtime-indicator.stopping { color: #805e18; background: #fff8e8; }
.runtime-indicator.offline { color: var(--red); background: #fff0f2; }
@keyframes runtime-pulse {
  50% { opacity: .4; transform: scale(.8); }
}
.logout-form button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.logout-form button:hover { color: var(--red); }
.page { max-width: 1180px; margin: 0 auto; padding: 48px 24px 80px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.hero.compact { margin-bottom: 28px; }
.hero h1 { margin: 6px 0 8px; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; letter-spacing: -1.8px; }
.hero.compact h1 { font-size: clamp(28px, 4vw, 40px); }
.eyebrow { margin: 0; color: var(--violet); font-weight: 750; font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; }
.muted { margin: 0; color: var(--muted); font-size: 16px; }
.back { display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.external { color: var(--blue); font-size: 14px; overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.button {
  min-height: 42px;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.button:hover { border-color: #c6cad2; }
.button.primary { border-color: var(--blue); background: var(--blue); color: white; }
.button.primary:hover { background: var(--blue-dark); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stats article { padding: 22px 24px; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.stats span { color: var(--muted); font-size: 13px; font-weight: 650; }
.stats strong { margin: 5px 0 1px; font-size: 32px; line-height: 1; letter-spacing: -1px; }
.stats strong.word { font-size: 22px; letter-spacing: -.5px; }
.stats small { color: var(--muted); }

.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.form-layout { grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); align-items: start; }
.panel { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.panel h2 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.panel-head { min-height: 62px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-head a { color: var(--blue); font-size: 13px; font-weight: 700; }
.badge { min-width: 28px; padding: 4px 8px; border-radius: 20px; background: #edf3ff; color: var(--blue); text-align: center; font-size: 12px; font-weight: 800; }

.rows { display: grid; }
.row { min-height: 70px; padding: 14px 20px; display: grid; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
a.row:hover { background: #fafbfc; }
.row > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.row strong { overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 720; }
.row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.row time, .snapshot time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.target-row { grid-template-columns: 10px minmax(0, 1fr) auto; }
.event-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
.report-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 4px #e9f8f2; }
.status-dot.off { background: #aeb3bd; }
.event-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: #f1edff; color: var(--violet); font-weight: 800; }
.report-icon { width: 40px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #fff0f2; color: var(--red); font-size: 10px; font-weight: 850; }
.danger { color: var(--red) !important; }
.empty { padding: 48px 24px; color: var(--muted); text-align: center; }

.form-panel { padding: 22px; }
.form-panel h2 { margin-bottom: 22px; }
form { margin: 0; }
.form-panel form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #3c414b; font-size: 13px; font-weight: 700; }
input, select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d7dae0;
  border-radius: 9px;
  outline: none;
  background: white;
  color: var(--text);
}
textarea {
  width: 100%;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid #d7dae0;
  border-radius: 9px;
  outline: none;
  background: white;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #e8f0ff; }
.form-hint { margin: -3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.notice { margin: 0 0 22px; padding: 13px 16px; border-radius: 10px; font-size: 14px; }
.notice.error { background: #fff0f2; color: #a91f36; }
.notice.success { background: #eaf8f2; color: #08764a; }
.notice.info { background: #edf3ff; color: #315b9d; }

.inline-check input { width: 16px; height: 16px; flex: 0 0 auto; }
.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.button:disabled { opacity: .5; cursor: not-allowed; }

.snapshot { border-bottom: 1px solid var(--line); }
.snapshot:last-child { border-bottom: 0; }
.snapshot summary { min-height: 70px; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.snapshot summary span { display: grid; gap: 4px; }
.snapshot summary small { color: var(--muted); }
.snapshot pre { max-height: 420px; margin: 0; padding: 18px 20px; overflow: auto; border-top: 1px solid var(--line); background: #171a21; color: #e9edf5; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }

.screenshot-panel { margin-bottom: 24px; }
.screenshot-grid { padding: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.screenshot-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.screenshot-card:hover { border-color: #b9c7de; box-shadow: 0 8px 24px rgb(29 45 71 / 8%); }
.screenshot-card img { width: 100%; aspect-ratio: 16 / 10; display: block; object-fit: cover; object-position: top; background: #e8ebf0; }
.screenshot-card > span { padding: 11px 12px; display: grid; gap: 3px; }
.screenshot-card strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.screenshot-card small { color: var(--muted); font-size: 11px; }

.schedule-panel {
  margin-bottom: 24px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.schedule-panel > div { display: grid; gap: 4px; }
.schedule-panel small { color: var(--muted); font-size: 12px; }
.schedule-panel form { display: flex; align-items: flex-end; gap: 10px; }
.schedule-panel label { min-width: 150px; }
.schedule-panel label span { font-size: 11px; }
.group-schedule-panel { align-items: flex-start; }
.group-schedule-form { flex-wrap: wrap; justify-content: flex-end; }
.group-schedule-form .inline-check { min-width: auto; align-self: center; }
.schedule-create-panel { margin-bottom: 22px; }
.schedule-create-panel .schedule-editor { padding: 20px; }
.schedule-list { display: grid; gap: 18px; }
.schedule-card { overflow: hidden; }
.schedule-card-head {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.schedule-card-head > div { display: grid; gap: 5px; }
.schedule-card-head h2,
.schedule-card-head p { margin: 0; }
.schedule-card-head p { color: #374151; font-weight: 700; }
.schedule-card-head small { color: var(--muted); }
.schedule-state {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 14px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.schedule-state.active { background: #e6f7f0; color: #08784a; }
.schedule-state.paused { background: #eef0f3; color: #697180; }
.schedule-editor {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  align-items: end;
  gap: 14px;
}
.schedule-editor label { min-width: 0; }
.schedule-editor [hidden] { display: none !important; }
.schedule-editor .inline-check { align-self: center; }
.schedule-actions {
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}
.account-usage-panel {
  margin-bottom: 24px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
  align-items: start;
  gap: 20px;
}
.account-usage-panel > div { display: grid; gap: 5px; }
.account-usage-panel small,
.account-usage-panel span { color: var(--muted); font-size: 12px; }
.usage-links { display: flex !important; flex-wrap: wrap; gap: 8px !important; }
.usage-links a {
  padding: 6px 9px;
  border-radius: 14px;
  background: #edf3ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
}

.login-body { min-height: 100vh; background: #eef2f8; }
.login-shell { min-height: 100vh; padding: 24px; display: grid; place-items: center; }
.login-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgb(27 43 67 / 10%);
}
.login-brand { display: inline-block; margin-bottom: 42px; }
.login-card h1 { margin: 8px 0; font-size: 34px; letter-spacing: -1px; }
.login-card .muted { margin-bottom: 24px; }
.login-card .notice { margin-bottom: 18px; }
.login-card form { display: grid; gap: 16px; }

.group-list { display: grid; }
.group-card {
  min-height: 88px;
  padding: 17px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.group-card:last-child { border-bottom: 0; }
.group-card:hover { background: #fafbfc; }
.group-card > span:first-child { min-width: 0; display: grid; gap: 5px; }
.group-card strong { font-size: 15px; }
.group-card small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.group-counts { color: var(--muted); font-size: 12px; white-space: nowrap; }
.group-counts b { color: var(--text); }
.group-counts em { margin-left: 8px; padding: 4px 7px; border-radius: 12px; background: #e9f8f2; color: var(--green); font-style: normal; font-weight: 800; }

.analysis-columns { margin-bottom: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.role-panel { border-top: 3px solid var(--blue); }
.reference-panel { border-top-color: var(--violet); }
.role-panel .panel-head { min-height: 72px; }
.role-kicker { margin: 0 0 3px; color: var(--violet); font-size: 9px; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; }
.role-kicker.competitor { color: var(--blue); }
.member-list { display: grid; }
.member-card { padding: 16px 20px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.member-card:last-child { border-bottom: 0; }
.member-card a { min-width: 0; display: grid; gap: 4px; }
.member-card a strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.member-card a small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.member-actions { display: flex; gap: 12px; }
.member-actions form button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}
.member-actions form button.danger-link { color: var(--red); }
.compact-empty { padding: 28px 20px; }
.analysis-bottom { align-items: start; }
.group-reports-panel { margin-top: 24px; }
.group-reports-panel .panel-head > div { display: grid; gap: 4px; }
.group-reports-panel .panel-head small { color: var(--muted); font-size: 11px; }
.danger-button { border-color: #f0a7b3; color: var(--red); }

.settings-layout {
  margin-bottom: 24px;
  grid-template-columns: minmax(340px, .85fr) minmax(0, 1.15fr);
  align-items: start;
}
.settings-delay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-check { padding: 5px 0; }
.strategy-guide .panel-head,
.diagnostics-panel .panel-head { align-items: center; }
.strategy-guide .panel-head > div,
.diagnostics-panel .panel-head > div { display: grid; gap: 4px; }
.diagnostics-panel .panel-head small { color: var(--muted); font-size: 11px; }
.strategy-notes { padding: 20px; display: grid; gap: 16px; }
.strategy-notes article { display: grid; gap: 5px; }
.strategy-notes article strong { font-size: 14px; }
.strategy-notes article p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.strategy-notes .notice { margin: 0; }
.diagnostics-panel { margin-bottom: 24px; }
.diagnostic-stats { padding: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.diagnostic-stats article {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}
.diagnostic-stats strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; }
.diagnostic-stats span { font-size: 12px; }
.diagnostic-stats small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.attempt-table-wrap { overflow: auto; }
.attempt-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.attempt-table th,
.attempt-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.attempt-table th { color: var(--muted); background: #fafbfc; font-size: 9px; letter-spacing: .5px; text-transform: uppercase; }
.attempt-table td:nth-child(2) { min-width: 210px; white-space: normal; }
.attempt-table td:nth-child(2) strong,
.attempt-table td:nth-child(2) small { display: block; }
.attempt-table td:nth-child(2) small { margin-top: 3px; color: var(--muted); }
.attempt-error td { padding-top: 7px; padding-bottom: 10px; background: #fff8f9; color: var(--red); white-space: normal; }
.attempt-outcome { padding: 4px 7px; border-radius: 12px; background: #eef2f7; font-size: 9px; font-weight: 800; }
.attempt-outcome.success,
.attempt-outcome.unchanged { background: #e9f8f2; color: var(--green); }
.attempt-outcome.blocked,
.attempt-outcome.captcha { background: #fff4df; color: #a95800; }
.attempt-outcome.failed { background: #fff0f2; color: var(--red); }

.run-panel { margin-bottom: 24px; }
.run-panel .panel-head > div { display: grid; gap: 4px; }
.run-panel .panel-head small { color: var(--muted); font-size: 11px; }
.run-status { padding: 5px 9px; border-radius: 16px; background: #eef2f7; color: #536070; font-size: 11px; }
.run-status.running, .run-status.pending { background: #e8f0ff; color: var(--blue); }
.run-status.captcha { background: #fff4df; color: #b36304; }
.run-status.completed { background: #e9f8f2; color: var(--green); }
.run-status.failed, .run-status.stopped { background: #fff0f2; color: var(--red); }
.run-progress-wrap { padding: 20px; }
.run-progress { height: 10px; overflow: hidden; border-radius: 20px; background: #e9edf3; }
.run-progress span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width .35s ease; }
.run-progress-meta { margin-top: 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.run-progress-meta strong { color: var(--text); }
.run-items { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.run-item { min-height: 60px; padding: 12px 20px; display: grid; grid-template-columns: 10px minmax(0, 1fr); align-items: center; gap: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.run-item > span:last-child { min-width: 0; display: grid; gap: 3px; }
.run-item strong, .run-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-item strong { font-size: 12px; }
.run-item small { color: var(--muted); font-size: 10px; }
.run-row { grid-template-columns: 10px minmax(0, 1fr) auto; }
.run-history-actions { display: flex; align-items: center; gap: 10px; }
.run-history-actions form,
.run-history-entry form { margin: 0; }
.run-history-actions button,
.run-history-entry form button {
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 760;
}
.run-history-actions button:hover,
.run-history-entry form button:hover { text-decoration: underline; }
.run-history-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.run-history-entry:last-child { border-bottom: 0; }
.run-history-entry .row { border-bottom: 0; }
.run-history-entry > form { padding-right: 12px; }
.run-dot { width: 9px; height: 9px; border-radius: 50%; background: #aeb3bd; }
.run-dot.running { background: var(--blue); box-shadow: 0 0 0 4px #e8f0ff; }
.run-dot.captcha { background: #e88a17; box-shadow: 0 0 0 4px #fff3df; }
.run-dot.completed { background: var(--green); }
.run-dot.failed { background: var(--red); }
.run-dot.stopped { background: #7b8290; }

.captcha-container { border-top: 1px solid var(--line); background: #111827; }
.captcha-head { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; color: white; }
.captcha-head > div { display: grid; gap: 3px; }
.captcha-head small { color: #aab5c6; font-size: 10px; }
.live-badge { padding: 4px 7px; border-radius: 12px; background: #d9314f; color: white; font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.captcha-container iframe { width: 100%; height: 720px; display: block; border: 0; background: #111827; }

@media (max-width: 800px) {
  .page { padding-top: 32px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .stats, .stats.four { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .grid.form-layout { grid-template-columns: 1fr; }
  .screenshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-panel { align-items: stretch; flex-direction: column; }
  .schedule-panel form { align-items: stretch; }
  .schedule-card-head { flex-direction: column; }
  .schedule-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-usage-panel { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .diagnostic-stats { grid-template-columns: 1fr; }
  .analysis-columns { grid-template-columns: 1fr; }
  .run-items { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 18px; }
  .brand { font-size: 19px; }
  .brand span { display: none; }
  .topbar nav { gap: 8px; font-size: 12px; }
  .topbar nav a:nth-child(1),
  .topbar nav a:nth-child(2),
  .topbar nav a:nth-child(5) { display: none; }
  .runtime-indicator span:last-child { display: none; }
  .runtime-indicator { padding-inline: 8px; }
  .page { padding-inline: 14px; }
  .row time { display: none; }
  .stats, .stats.four, .screenshot-grid { grid-template-columns: 1fr; }
  .schedule-editor { grid-template-columns: 1fr; }
  .schedule-actions { align-items: stretch; flex-direction: column; }
  .schedule-actions .button { width: 100%; }
}
