:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-hover: #5ca0ff;
  --ok: #3dd68c;
  --warn: #f5a524;
  --danger: #f2555a;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

code {
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.header h1 { margin: 0; font-size: 1.75rem; }
.subtitle { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }

.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.schedule-banner {
  margin: 0 1.5rem 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
}
.schedule-banner.active { border-color: var(--accent); }
.schedule-banner.inactive { color: var(--muted); }

.jobs-panel {
  margin: 0 1.5rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.jobs-panel.hidden { display: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.stat-card strong { display: block; font-size: 1.4rem; }
.stat-card span { color: var(--muted); font-size: 0.85rem; }

.toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem 1rem;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
}

.toolbar input { flex: 1; min-width: 200px; }

main { padding: 0 1.5rem 2rem; }

.library {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.library th,
.library td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.library th {
  background: #152030;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.library tr:last-child td { border-bottom: none; }

.title-cell strong { display: block; }
.path-cell { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; word-break: break-all; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  margin-right: 0.25rem;
}
.badge.ok { background: rgba(61, 214, 140, 0.2); color: var(--ok); }
.badge.miss { background: rgba(245, 165, 36, 0.15); color: var(--warn); }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 0.35rem 0.6rem; font-size: 0.8rem; }

.muted { color: var(--muted); }

.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin: 0.1rem; }

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: calc(100% - 2rem);
  padding: 1.25rem;
}

.detail-pre {
  background: var(--bg);
  padding: 0.75rem;
  border-radius: var(--radius);
  overflow: auto;
  max-height: 50vh;
  font-size: 0.8rem;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.upload-section {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.upload-heading {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.upload-hint {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
}

.upload-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.upload-row input[type="file"],
.upload-row select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
}

.upload-row input[type="file"] {
  flex: 1;
  min-width: 160px;
}

.upload-preview {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.upload-preview.hidden { display: none; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); }

@media (max-width: 700px) {
  .library thead { display: none; }
  .library tr { display: block; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
  .library td { display: block; border: none; }
}
