:root {
  color-scheme: light dark;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --primary: #2563eb;
  --secondary: #0f172a;
  --success: #15803d;
  --danger: #dc2626;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(96%, 1280px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
}

.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand a {
  text-decoration: none;
  color: var(--secondary);
}

nav .link {
  margin-left: 1rem;
  text-decoration: none;
  color: var(--primary);
}

.welcome {
  margin-right: 1rem;
  color: var(--muted);
}

main.container {
  flex: 1;
  width: min(96%, 1400px);
  max-width: 1400px;
}

.footer {
  background: transparent;
  text-align: center;
  padding: 1rem 0 2rem;
  color: var(--muted);
}

.panel {
  background: var(--card);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.panel h2 {
  margin-top: 0;
}

.auth-card {
  background: var(--card);
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  margin: 2rem auto;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.08);
}

.auth-card h2 {
  margin-top: 0;
}

label {
  display: block;
  margin: 1rem 0 0.5rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  resize: vertical;
}

textarea {
  min-height: 120px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.15s ease;
}

button.primary {
  background: var(--primary);
  color: #fff;
}

button.secondary {
  background: var(--secondary);
  color: #fff;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.5rem 1rem;
}

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

button:hover {
  transform: translateY(-1px);
}

.schedule-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.schedule-item input[type="time"] {
  width: 8rem;
}

.hint {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-weight: 500;
}

.radio-group input[type="radio"] {
  accent-color: var(--primary);
}

.flash-messages {
  list-style: none;
  padding: 0;
}

.flash {
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.1);
}

.flash.error {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.flash.success {
  background: rgba(21, 128, 61, 0.12);
  color: var(--success);
}

.flash.info {
  background: rgba(37, 99, 235, 0.12);
}

.flash.warning {
  background: rgba(202, 138, 4, 0.15);
}

.results {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.result-list {
  flex: 0 0 260px;
  max-width: 100%;
}

.result-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-list li {
  margin-bottom: 0.5rem;
}

.result-list a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
  color: inherit;
}

.result-list li.active a {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.result-list .status {
  font-size: 0.875rem;
  margin: 0 0.5rem;
}

.result-list .time {
  margin-left: auto;
}

.result-list .status.ok {
  color: var(--success);
}

.result-list .status.error {
  color: var(--danger);
}

.mode-tag {
  background: rgba(15, 23, 42, 0.08);
  color: var(--secondary);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.5rem;
  white-space: nowrap;
}

.result-detail {
  flex: 1;
  min-height: 320px;
}

.result-mode {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.result-mode .mode-tag {
  margin-right: 0;
}

.summary + .summary {
  margin-top: 1.5rem;
}

.dimension-nav {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
  flex-wrap: wrap;
}

.dimension-nav a {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--secondary);
  font-size: 0.9rem;
  background: rgba(37, 99, 235, 0.05);
}

.dimension-nav a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dimension-nav a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.category-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.category-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.65);
}

.category-card header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.category-card .title {
  font-size: 1.1rem;
  font-weight: 600;
}

.category-card .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.category-card .meta.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
}

.category-card .reason {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.category-reports {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.category-reports table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.category-reports th,
.category-reports td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.category-reports th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
}

.category-reports td ul {
  padding-left: 1.25rem;
  margin: 0.25rem 0;
}

.report-links {
  white-space: nowrap;
}

.report-links a {
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--primary);
  text-decoration: none;
}

.report-links a:hover {
  text-decoration: underline;
}

.muted-link {
  color: var(--muted);
  text-decoration: none;
}

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

.report + .report {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.report h4 {
  margin-bottom: 0.5rem;
}

.report h5 {
  margin-bottom: 0.25rem;
  margin-top: 1rem;
}

.muted {
  color: var(--muted);
}

.error-box {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 1rem;
  border-radius: 10px;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
}

.run-status {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.run-status .label {
  color: var(--muted);
}

.status-pill {
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(148, 163, 184, 0.2);
  color: var(--secondary);
}

.status-pill.running {
  background: rgba(21, 128, 61, 0.2);
  color: var(--success);
}

.status-pill.idle {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.status-pill.error {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

@media (max-width: 1200px) {
  .container,
  main.container {
    width: 95%;
  }

  .results {
    flex-direction: column;
  }

  .result-list {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .results {
    flex-direction: column;
  }

  .result-list {
    width: 100%;
  }
}

.status-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 2rem;
  z-index: 2000;
}

.status-dialog {
  width: min(420px, 100%);
  max-height: 85vh;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
}

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.status-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.status-close {
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.75rem;
}

.status-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
}

.status-log {
  font-family: "SFMono-Regular", "Menlo", "Monaco", "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-entry {
  background: rgba(37, 99, 235, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--secondary);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.status-entry.status-success {
  background: rgba(21, 128, 61, 0.12);
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.25);
  color: var(--success);
}

.status-entry.status-error {
  background: rgba(220, 38, 38, 0.12);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.2);
  color: var(--danger);
}

.status-entry .status-message {
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 768px) {
  .status-overlay {
    padding: 1rem;
    align-items: stretch;
  }

  .status-dialog {
    width: 100%;
    max-height: 100vh;
  }
}
