:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #161b22;
  --panel-alt: #1b2230;
  --line: #2b3544;
  --text: #e6edf3;
  --muted: #96a6bd;
  --accent: #ef8354;
  --accent-strong: #ffb26b;
  --success: #3fb950;
  --error: #ff7b72;
  --warning: #d8a657;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.shell {
  width: min(860px, calc(100% - 18px));
  margin: 0 auto;
  padding: 12px 0 18px;
}

.topbar,
.panel-heading,
.job-row,
.job-head,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar {
  margin-bottom: 8px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 14px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(100% - 24px, 390px);
  padding: 24px 0;
}

.login-panel {
  padding: 24px;
  border: 1px solid rgba(150, 166, 189, 0.22);
  border-radius: 8px;
  background: rgba(22, 27, 34, 0.96);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
}

.login-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 22px;
}

.login-heading h1 {
  font-size: 26px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.check-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.check-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.login-error {
  min-height: 17px;
  margin-top: 0;
}

.login-submit {
  width: 100%;
  min-height: 40px;
}

.panel {
  margin-top: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(27, 34, 48, 0.92), rgba(22, 27, 34, 0.96));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

input,
select {
  width: 100%;
  padding: 9px 11px;
  color: var(--text);
  background: rgba(13, 17, 23, 0.84);
  border: 1px solid var(--line);
  border-radius: 10px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a1a1a;
  font-weight: 700;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.ghost.is-paused {
  color: #1a1a1a;
  border-color: transparent;
  background: linear-gradient(135deg, var(--warning), var(--accent-strong));
  font-weight: 700;
}

.ghost.is-refreshing {
  color: #d6ffe0;
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(63, 185, 80, 0.14);
}

.danger {
  background: rgba(255, 123, 114, 0.1);
  color: #ffd0cb;
  border: 1px solid rgba(255, 123, 114, 0.35);
}

.compact {
  padding-inline: 11px;
  padding-top: 3px;
  padding-bottom: 3px;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.pill[data-state="online"] {
  color: #d6ffe0;
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(63, 185, 80, 0.14);
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.status-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.75);
  display: grid;
  gap: 4px;
}

.status-card strong {
  font-size: 20px;
}

.status-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(140px, 180px) minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-group {
  align-content: start;
}

.jobs {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.job {
  padding: 10px;
  background: rgba(13, 17, 23, 0.76);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.job[data-status="downloaded"] {
  border-color: rgba(63, 185, 80, 0.35);
}

.job[data-status="queue"] {
  border-color: rgba(150, 166, 189, 0.34);
}

.job[data-status="failed"] {
  border-color: rgba(255, 123, 114, 0.35);
}

.job[data-status="skipped"] {
  border-color: rgba(216, 166, 87, 0.42);
}

.job-head {
  align-items: flex-start;
}

.job-check {
  min-width: 18px;
  padding-top: 3px;
}

.job-check input {
  width: 16px;
  height: 16px;
}

.job-title {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.job-provider,
.job-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.job-actions {
  justify-content: flex-end;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(150, 166, 189, 0.32);
  background: rgba(150, 166, 189, 0.12);
  color: #dce7f5;
  font-size: 11px;
  font-weight: 700;
}

.provider-cobalt {
  color: #d6ffe0;
  border-color: rgba(63, 185, 80, 0.4);
  background: rgba(63, 185, 80, 0.14);
}

.provider-yt-dlp {
  color: #ffd9b8;
  border-color: rgba(239, 131, 84, 0.46);
  background: rgba(239, 131, 84, 0.16);
}

.provider-facebook {
  color: #dbeafe;
  border-color: rgba(59, 130, 246, 0.44);
  background: rgba(59, 130, 246, 0.16);
}

.provider-tiktok,
.provider-instagram,
.provider-pinterest {
  color: #f5d0fe;
  border-color: rgba(217, 70, 239, 0.4);
  background: rgba(217, 70, 239, 0.14);
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.job-url {
  margin-top: 6px;
  word-break: break-all;
  line-height: 1.35;
  font-size: 12px;
  color: var(--muted);
}

.progress-track {
  margin-top: 8px;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.job-transfer {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.job-transfer span {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.hint {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 12px;
}

.skipped-breakdowns {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.skipped-breakdowns[hidden] {
  display: none;
}

.skipped-breakdown {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(216, 166, 87, 0.28);
  border-radius: 8px;
  background: rgba(216, 166, 87, 0.08);
  color: #f0d7a7;
}

.skipped-breakdown p {
  margin: 2px 0 0;
  line-height: 1.35;
}

.skipped-breakdown strong {
  display: block;
  color: #ffe4ad;
}

.skipped-breakdown button {
  flex: 0 0 auto;
}

.error {
  margin-top: 6px;
  color: var(--error);
  font-size: 12px;
}

code {
  color: #f7d7b5;
  word-break: break-all;
  font-size: 12px;
}

.pagination {
  margin-top: 12px;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 12px, 860px);
    padding-top: 10px;
  }

  .panel {
    padding: 10px;
  }

  .status-bar,
  .toolbar,
  .field-row {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions button,
  .heading-actions button,
  .job-actions button,
  .pagination button {
    width: 100%;
  }

  .pagination,
  .topbar,
  .panel-heading,
  .job-row,
  .job-head {
    display: grid;
    justify-content: stretch;
  }
}
