:root {
  color-scheme: dark;
  --bg: #101114;
  --card: #1a1d22;
  --line: #2c313a;
  --text: #ece7df;
  --muted: #a39b90;
  --accent: #e2a65a;
  --accent-text: #1a140c;
  --danger: #e07a72;
  --ok: #8fbf9f;
}

* { box-sizing: border-box; }

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

.wrap {
  width: min(640px, calc(100% - 32px));
  margin: 48px auto;
}

.wrap.wide { width: min(1100px, calc(100% - 32px)); }

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

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
}

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

.quiet:hover { color: var(--text); }

.lead, .hint { color: var(--muted); }

label {
  display: block;
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: 14px;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

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

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

.row {
  display: flex;
  gap: 8px;
}

.row input, .row select { flex: 1; }

#quality-row { margin-top: 8px; }

#found-title {
  margin: 12px 0 0;
  font-weight: 650;
}

#job {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

#media-title {
  margin: 0 0 8px;
  font-weight: 650;
}

#status { margin: 0 0 12px; }

#manual { margin: 12px 0 0; }

#manual a { color: var(--accent); }

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.track {
  position: relative;
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a241c;
}

#bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s linear;
}

#bar.indeterminate {
  width: 35%;
  animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

#percent {
  min-width: 3ch;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.panel-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 8px 0 12px;
}

.panel-bar .row { flex: 1; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th { color: var(--muted); font-weight: 600; }

tr:last-child td { border-bottom: 0; }

td a {
  color: var(--accent);
  word-break: break-all;
}

.status-ok { color: var(--ok); }
.status-error { color: var(--danger); }
.status-started { color: var(--accent); }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

#login-form button { margin-top: 16px; }

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-shell[hidden] {
  display: none !important;
}

.admin-side {
  width: 240px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: #14171b;
}

.brand {
  margin: 0 8px 12px;
  font-weight: 650;
}

.admin-side nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

button.menu {
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 500;
}

button.menu.active {
  background: var(--card);
  color: var(--accent);
}

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 32px;
}

.admin-main h1 { margin-bottom: 16px; }

.about-card {
  margin: 0 0 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.about-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.about-card p { margin: 0; }

code {
  font-family: ui-monospace, monospace;
  font-size: 0.92em;
}

@media (max-width: 800px) {
  .admin-shell { flex-direction: column; }
  .admin-side {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .admin-side nav { flex-direction: row; }
  .side-foot { margin-top: 12px; flex-direction: row; align-items: center; }
  .admin-main { padding: 20px 16px 32px; }
}

@media (max-width: 640px) {
  .row, .panel-bar { flex-direction: column; align-items: stretch; }
  .wrap { margin: 24px auto; }
}
