:root {
  --bg: #0b0b0c;
  --panel: #131316;
  --panel-2: #1a1a1f;
  --text: #ececee;
  --muted: #8c8c96;
  --line: rgba(255, 255, 255, 0.075);
  --accent: #c9f24d;
  --accent-ink: #11140a;
  --danger: #ff7a7a;
  --ok: #7ce2a6;
  --radius: 16px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 15% -120px, rgba(201, 242, 77, 0.09), transparent 70%),
    radial-gradient(700px 380px at 100% 0%, rgba(120, 160, 255, 0.06), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 24px 70px;
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.sub {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.top-actions { display: flex; align-items: center; gap: 14px; }

.lib {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:active { transform: translateY(1px); }

.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #d7ff63; }

.btn.ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}
.btn.ghost:hover { background: var(--panel-2); border-color: rgba(255, 255, 255, 0.16); }

.btn.tiny {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn.icon {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.btn.icon:hover { color: var(--text); background: var(--panel-2); }
.btn.icon.danger:hover { color: var(--danger); border-color: rgba(255, 122, 122, 0.35); }

/* ---------- hero / stats ---------- */

.hero { margin-top: 42px; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 34px;
  margin-bottom: 26px;
}

.stat { display: flex; flex-direction: column; gap: 2px; }

.stat .num {
  font-family: var(--mono);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-icon {
  position: absolute;
  left: 18px;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  pointer-events: none;
}

.search input {
  flex: 1;
  height: 56px;
  padding: 0 18px 0 50px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search input::placeholder { color: #66666f; }

.search input:focus {
  border-color: rgba(201, 242, 77, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 242, 77, 0.1);
  background: #16161a;
}

.search .btn.primary {
  height: 42px;
  padding: 0 20px;
  border-radius: 11px;
  margin-right: 7px;
}

.hint {
  margin: 10px 2px 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- results ---------- */

.results {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 14px;
  animation: rise 0.25s ease both;
}

.result {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 13px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.result:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.16); }

.result .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #1c1c22;
  overflow: hidden;
}

.result .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result .dur {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.78);
  font-family: var(--mono);
  font-size: 10.5px;
}

.result .body {
  padding: 10px 11px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.result .t {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result .a {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}

.result .btn { margin-top: auto; justify-content: center; }

/* ---------- panels ---------- */

.panel { margin-top: 44px; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.count { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.job {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px 14px;
  overflow: hidden;
  animation: rise 0.22s ease both;
}

.job.working { border-color: rgba(201, 242, 77, 0.3); }

.job .row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.job .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}

.job.queued .dot { background: #7d8ea8; }
.job.working .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(201, 242, 77, 0.12); animation: pulse 1.6s infinite; }
.job.done .dot { background: var(--ok); }
.job.error .dot { background: var(--danger); }
.job.cancelled .dot { background: #55555f; }

.job .main { min-width: 0; flex: 1; }

.job .title {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job .msg {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.job.error .msg {
  color: var(--danger);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.job .pct {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.job .bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.job .bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease;
}

.job.done .bar > i { background: var(--ok); }
.job.error .bar > i { background: var(--danger); }

.job .actions { display: flex; gap: 6px; }

.empty { font-size: 13px; color: var(--muted); margin: 6px 2px 0; }

.recent {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2px 26px;
}

.recent li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  min-width: 0;
}

.recent .rt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent .ra {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  flex: none;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foot {
  margin-top: 54px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: #5f5f69;
}

/* ---------- veille ---------- */

.watch-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.watch-add {
  display: flex;
  gap: 8px;
  margin: 4px 0 16px;
}

.watch-add input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
}
.watch-add input:focus { border-color: rgba(201, 242, 77, 0.5); }
.watch-add .btn { height: 40px; }

.watch-cols {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 22px;
}

.watch-col h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.watch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 330px;
  overflow-y: auto;
}

.watch-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.watch-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.watch-name {
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-auto {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
  flex: none;
  cursor: pointer;
}

.watch-auto input { accent-color: var(--accent); }

.watch-cover {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  background: #202027;
  flex: none;
}

.watch-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  flex: none;
}
.watch-tag.queued { color: var(--accent); background: rgba(201, 242, 77, 0.1); }
.watch-tag.imported { color: var(--ok); background: rgba(124, 226, 166, 0.1); }
.watch-tag.ignored { color: #777; }
.watch-tag.error { color: var(--danger); background: rgba(255, 122, 122, 0.1); }

.watch-bulk { margin-top: 18px; }
.watch-bulk summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.watch-bulk textarea {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
}
.watch-bulk-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.watch-bulk code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

@media (max-width: 760px) {
  .watch-cols { grid-template-columns: 1fr; }
}

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: rise 0.2s ease both;
}

.toast.error { border-left-color: var(--danger); }

/* ---------- animations ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(201, 242, 77, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(201, 242, 77, 0.04); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  .shell { padding: 20px 16px 50px; }
  .lib { display: none; }
  .hero { margin-top: 30px; }
  .stats { gap: 22px; }
  .stat .num { font-size: 21px; }
  .search input { height: 50px; font-size: 14px; padding-left: 44px; }
  .search .btn.primary { height: 38px; padding: 0 14px; }
  .search-icon { left: 15px; }
  .results { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
}
