:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #fff;
  --raised: #f0f1f3;
  --hover: #e9edf0;
  --line: #d7dadd;
  --text: #33383e;
  --muted: #636a71;
  --green: #237949;
  --green-strong: #268353;
  --green-soft: #e7f2eb;
  --olive: #747b28;
  --warn: #926812;
  --danger: #ba3d3d;
  --blue: #327c9f;
  --header: #454950;
  --sidebar: #52575c;
  --shadow: 0 8px 28px #0003;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  font:
    14px/1.45 Arial,
    Helvetica,
    sans-serif;
}
.library-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 16px; }
.library-tabs .button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 20px; background: transparent; }
.library-tabs .button.active, .library-tabs .button.active:hover { border-bottom-color: var(--green); color: var(--green); font-weight: 600; background: transparent; }
.library-tabs span { margin-left: 8px; font-variant-numeric: tabular-nums; color: var(--muted); }
.library-toolbar { display: flex; gap: 18px; align-items: center; }
.library-search { display: flex; align-items: center; gap: 10px; flex: 1; }
.library-search input { width: 100%; }
.library-filter { display: flex; align-items: center; gap: 10px; }
.library-policy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 14px 0 20px; }
.library-policy label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.library-policy input { accent-color: var(--green); width: 16px; height: 16px; flex: none; }
.library-title { background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.show-heading, .movie-heading { padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.show-toggle { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.show-toggle::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); flex-shrink: 0; }
.show-group.expanded .show-toggle::before { transform: rotate(45deg); }
.show-heading:hover { background: var(--hover); }
.show-rule { display: flex; align-items: center; gap: 10px; flex: none; font-weight: 600; }
.show-rule .library-preference { width: 190px; }
.title-identity { display: flex; gap: 14px; align-items: center; min-width: 0; flex: 1; }
.title-identity strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.title-identity small { display: block; color: var(--muted); margin-top: 4px; }
.library-poster { object-fit: cover; flex-shrink: 0; background: var(--raised); }
.show-expand { color: var(--muted); font-size: 12px; }
.title-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 12px 16px; border-top: 1px solid var(--line); }
.title-rule label { display: flex; align-items: center; gap: 12px; font-weight: 600; white-space: nowrap; }
.title-rule select { width: 190px; flex: none; }
.movie-heading .title-rule { border-top: 0; padding: 0; max-width: 430px; }
.season-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; background: var(--raised); border-top: 1px solid var(--line); }
.season-toggle { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font-weight: 600; text-align: left; }
.season-toggle::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); flex: none; }
.library-season.expanded .season-toggle::before { transform: rotate(45deg); }
.season-toggle small { color: var(--muted); font-size: 11px; font-weight: 400; }
.season-toggle:hover span { text-decoration: underline; text-underline-offset: 3px; }
.library-preference { font-size: 12px; max-width: 210px; min-height: 34px; width: 100%; }
.library-table table { width: 100%; table-layout: fixed; }
.library-table th:first-child { width: 30%; }
.library-table th:nth-child(2) { width: 10%; }
.library-table th:nth-child(3) { width: 15%; }
.library-table th:nth-child(4) { width: 22%; }
.library-table th:last-child { width: 23%; }
.library-table td { vertical-align: top; overflow-wrap: anywhere; }
.library-file > div { display: flex; gap: 10px; align-items: center; }
.show-group .library-file > div { align-items: baseline; }
.episode-number { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); font-size: 12px; }
.movie-year { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 3px; }
.file-path { color: var(--muted); font-size: 11px; margin-top: 6px; }
.file-path summary { cursor: pointer; }
.file-path span { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.library-decision { display: block; font-weight: 600; }
.decision-reason { display: block; color: var(--muted); font-size: 11px; margin: 3px 0 7px; }
.library-file-actions .row-actions { flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
.library-queue-note { margin-top: 16px; max-width: none; }
@media (max-width: 900px) {
  .library-table table, .library-table tbody { display: block; }
  .library-table thead { display: none; }
  .library-table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; border-bottom: 1px solid var(--line); gap: 8px; }
  .library-table td { display: block; border: 0; padding: 5px; min-width: 0; }
  .library-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
  .library-table .library-file, .library-table .library-file-actions { grid-column: 1 / -1; }
  .library-table td[data-label="Processing"] { grid-column: 1 / -1; }
  .movie-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 540px) {
  .library-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .library-filter select { flex: 1; }
  .show-expand { display: none; }
  .title-rule label { width: 100%; justify-content: space-between; }
  .season-heading { padding: 10px; }
  .season-heading select { max-width: 180px; }
  .show-heading { padding: 12px; flex-wrap: wrap; gap: 10px; }
  .show-toggle { width: 100%; flex-basis: 100%; }
  .show-rule { width: 100%; justify-content: space-between; padding-left: 22px; }
  .show-rule .library-preference { max-width: 180px; }
  .title-identity { gap: 10px; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #22262b;
  --surface: #292e34;
  --raised: #30363d;
  --hover: #383f47;
  --line: #444b54;
  --text: #e0e3e7;
  --muted: #b0b6be;
  --green: #71c18f;
  --green-strong: #268353;
  --green-soft: #304c3b;
  --olive: #bbc269;
  --warn: #e5bd63;
  --danger: #eb9292;
  --blue: #83b9d7;
  --header: #30353c;
  --sidebar: #363c43;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.45 Arial,
    Helvetica,
    sans-serif;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
a {
  color: var(--green);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--green);
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
::selection {
  background: #176b9b;
  color: #fff;
}
:root[data-theme="dark"] ::selection {
  background: #a8d8f0;
  color: #14232c;
}
input,
textarea {
  caret-color: var(--green);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 21px;
  font-weight: 400;
}
h2 {
  font-size: 16px;
  font-weight: 500;
}
h3 {
  font-size: 14px;
  font-weight: 600;
}
p {
  max-width: 75ch;
}
.hint,
.muted {
  color: var(--muted);
}
.hint {
  font-size: 12px;
}
.error-text {
  color: var(--danger);
}
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sr-only,
.skip:not(:focus-visible) {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
}
.skip:focus-visible {
  position: fixed;
  z-index: 100;
  left: 12px;
  top: 8px;
  padding: 12px;
  background: var(--surface);
}
.workspace {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #f1f2f3;
}
.brand {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 23px;
  background: var(--header);
  color: #fff;
  font-size: 25px;
  font-weight: 600;
  text-decoration: none;
}
.brand:hover {
  color: #fff;
  text-decoration: none;
}
.brand img {
  border-radius: 2px;
}
.sidebar nav {
  padding-top: 8px;
  display: grid;
  gap: 0;
}
.nav-link {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 43px;
  padding: 10px 25px;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #f0f1f3;
  font-size: 14px;
}
.nav-link:hover {
  color: #fff;
  background: #ffffff12;
  text-decoration: none;
}
.nav-link.active {
  color: #cee3a4;
  background: #0004;
  font-weight: 500;
  box-shadow: inset 1px 0 var(--olive);
}
.nav-link .count {
  margin-left: auto;
  padding: 1px 5px;
  min-width: 21px;
  text-align: center;
  background: #30343a;
  border-radius: 2px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #e0e2e5;
}
.nav-separator {
  border-top: 1px solid #ffffff20;
  margin: 12px 22px;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 0 14px 14px;
  display: grid;
  gap: 12px;
}
.worker-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  background: #0002;
  border-top: 1px solid #ffffff1f;
  border-bottom: 1px solid #0003;
}
.worker-status > span:last-child {
  display: grid;
  gap: 1px;
}
.worker-status small,
.release-meta small {
  color: #c5c9cc;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
}
.worker-status strong {
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}
.release-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 2px;
}
.release-meta > span {
  display: grid;
  gap: 2px;
}
.release-meta strong {
  color: #f2f3f4;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.sidebar-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
  border-top: 1px solid #ffffff1f;
  padding-top: 10px;
}
.sidebar-actions button {
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  color: #eef0f1;
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 11px;
  text-align: left;
}
.sidebar-actions button:hover {
  color: #fff;
  background: #ffffff12;
}
.sidebar-actions #theme-button {
  flex: 1;
  display: grid;
  gap: 1px;
}
.sidebar-actions #theme-button strong {
  font-size: 10px;
  font-weight: 500;
}
.sidebar-actions .sign-out {
  flex: none;
  color: #ffd6d6;
  text-align: center;
}
.sidebar-actions .sign-out:hover {
  color: #fff;
  background: #7c2929;
  border-color: #a95050;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--green);
  flex: none;
}
.sidebar .status-dot {
  background: #86cda0;
}
.status-dot.warning {
  background: var(--warn);
}
.main-shell {
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 60px;
  background: var(--header);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 23px;
  color: #fff;
}
.global-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 320px;
  width: 100%;
  color: #f5f5f5;
  text-decoration: none;
  border-bottom: 1px solid #c0c4c8;
  padding: 5px 0;
  font-size: 13px;
}
.global-search:hover {
  color: #fff;
  text-decoration: none;
}
.global-search kbd {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: #ddd;
}
.connection-status {
  margin-left: auto;
  color: #dce1e5;
  font-size: 12px;
}
#breadcrumb {
  display: none;
}
.mobile-only {
  display: none;
}
main {
  padding: 0 24px 30px;
}
.page-heading {
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 0 -24px 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
}
.page-heading p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}
.page-heading p:empty {
  display: none;
}
.actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  min-height: 33px;
  font-size: 12px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  --bs-btn-focus-shadow-rgb: 38, 131, 83;
}
.button:hover {
  background: var(--hover);
  border-color: #9da4ac;
  color: var(--text);
  text-decoration: none;
}
.button.primary {
  color: #fff;
  background: var(--green-strong);
  border-color: var(--green-strong);
}
.button.primary:hover {
  filter: brightness(1.08);
}
.button.danger {
  color: var(--danger);
}
.button.small {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}
.page-heading .button:not(.primary) {
  background: transparent;
  border-color: transparent;
  padding: 6px 12px;
  border-radius: 0;
}
.page-heading .button:not(.primary):hover {
  background: var(--hover);
}
.page-heading .button + .button {
  border-left: 1px solid var(--line);
}
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px;
  border-radius: 3px;
}
.icon-button:hover {
  background: var(--hover);
}
.topbar .icon-button {
  color: white;
}
.overview-line {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 0 15px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.overview-line strong {
  font-weight: 600;
  color: var(--text);
}
.overview-line a {
  color: var(--warn);
}
.overview-line .last-sync {
  margin-left: auto;
}
.worker-band {
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 16px;
  background: var(--surface);
  border: 0;
  margin-bottom: 22px;
  min-height: 95px;
}
.worker-media {
  flex: 1;
  min-width: 0;
}
.active-title {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
  margin: 6px 0 3px;
}
.worker-progress {
  width: 32%;
  min-width: 210px;
}
.worker-band.idle {
  min-height: 48px;
  padding: 12px 15px;
  font-size: 12px;
  gap: 12px;
  background: var(--raised);
}
.worker-band.idle span {
  color: var(--muted);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  margin-bottom: 6px;
}
.progress-label strong {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
progress {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 14px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  accent-color: var(--green-strong);
}
progress::-webkit-progress-bar {
  background: var(--raised);
}
progress::-webkit-progress-value {
  background: var(--green-strong);
  transition: width 0.5s ease-out;
}
progress::-moz-progress-bar {
  background: var(--green-strong);
}
.stage-working {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}
.stage-working .icon {
  width: 15px;
  height: 15px;
  animation: spin 2s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin-bottom: 23px;
  min-width: 0;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 9px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  font-size: 17px;
  font-weight: 400;
}
.panel-header a,
.panel-header .hint {
  font-size: 12px;
}
.panel-body {
  padding: 14px 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 2px;
  font-size: 11px;
  padding: 3px 6px;
  white-space: nowrap;
  font-weight: 400;
  color: var(--muted);
  background: var(--raised);
  line-height: 1.4;
}
.badge.processing {
  color: #fff;
  background: var(--green-strong);
}
.badge.processing .status-dot {
  background: #c2ebd0;
}
.badge.completed,
.badge.unchanged {
  color: var(--green);
  background: var(--green-soft);
}
.badge.review,
.badge.waiting,
.badge.retry {
  color: var(--warn);
  background: var(--raised);
}
.badge.failed,
.badge.cancelled {
  color: var(--danger);
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 9px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  vertical-align: middle;
}
tbody tr:nth-child(odd) {
  background: var(--surface);
}
tbody tr:hover {
  background: var(--hover);
}
.title-cell {
  min-width: 220px;
  max-width: 700px;
}
.title-cell strong {
  display: block;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.title-cell small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.title-link {
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.title-link:hover {
  color: var(--green);
  text-decoration: underline;
}
.row-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  white-space: nowrap;
}
.inline-progress {
  margin-top: 6px;
  max-width: 180px;
}
.inline-progress progress {
  height: 7px;
}
.inline-progress .progress-label {
  font-size: 10px;
}
.system-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 20px;
  font-size: 11px;
}
.system-value { overflow-wrap: anywhere; }
.system-value > span { color: var(--muted); }
.system-service {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  text-decoration: none;
}
.status-dot.neutral { background: var(--muted); }
.system-wait {
  margin: -10px 0 20px;
  color: var(--warn);
  font-size: 12px;
}
.dashboard-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 34px;
  margin-bottom: 24px;
}
.dashboard-split .panel {
  margin-bottom: 0;
}
.dashboard-job-list {
  padding-top: 3px;
}
.dashboard-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 51px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.dashboard-job > div:first-child {
  min-width: 0;
}
.dashboard-job > div:last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.dashboard-job small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}
.system-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.system-row span {
  color: var(--muted);
}
.system-row strong {
  font-weight: 400;
  text-align: right;
}
.service-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.service-row div:nth-child(2) {
  flex: 1;
}
.service-row p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.service-row strong {
  font-weight: 500;
}
.service-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: var(--raised);
  font-weight: 600;
  color: var(--olive);
}
.empty {
  font-size: 12px;
  color: var(--muted);
  padding: 22px 15px;
  background: var(--raised);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.empty h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.empty p {
  font-size: 12px;
}
.empty > .icon {
  width: 17px;
  height: 17px;
}
.empty .button {
  margin-left: auto;
}
.queue-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 0 13px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.queue-toolbar input {
  max-width: 330px;
}
.queue-toolbar select {
  width: auto;
  min-width: 150px;
}
.queue-toolbar .hint {
  margin-left: auto;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 13px 0;
  color: var(--muted);
  font-size: 12px;
}
.search-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 0 0 15px;
  border-bottom: 1px solid var(--line);
  max-width: none;
}
.search-hero input {
  max-width: 650px;
}
.search-hero select {
  width: auto;
  min-width: 150px;
}
.search-hero .icon {
  color: var(--muted);
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
}
textarea {
  min-height: 75px;
  resize: vertical;
}
label small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.check-field {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.check-field input {
  height: 16px;
  width: 16px;
  /* The label is a flex sibling, so without this a long one shrinks the box. */
  flex-shrink: 0;
  accent-color: var(--green);
  margin-top: 2px;
}
.check-field span {
  display: grid;
  gap: 4px;
}
.asset-table table {
  width: auto;
  min-width: 340px;
  border-collapse: collapse;
}
.asset-table td:first-child {
  padding-right: 24px;
}
.asset-table .button.muted {
  opacity: 0.6;
}
.asset-table .button.danger {
  border-color: var(--danger);
  color: var(--danger);
}
.asset-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  padding-bottom: 4px;
}
.asset-table td {
  padding: 3px 8px 3px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.asset-table tr:last-child td {
  border-bottom: 0;
}
.asset-table .asset-pick {
  width: 26px;
  padding-right: 6px;
}
.asset-table .asset-pick input {
  height: 15px;
  width: 15px;
  accent-color: var(--green);
  vertical-align: middle;
}
.asset-table .asset-size,
.asset-table .asset-state {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}
.asset-table .asset-state button {
  padding: 1px 8px;
  font-size: 0.8rem;
}
.asset-table .state-ready {
  color: var(--green);
}
.asset-table .state-failed {
  color: var(--danger);
}
.asset-table small {
  display: block;
  margin-top: 6px;
}

.settings-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 950px);
  gap: 28px;
}
.settings-nav {
  display: grid;
  gap: 0;
  align-content: start;
  border-right: 1px solid var(--line);
}
.settings-nav .nav-link {
  padding: 9px 12px;
  min-height: 38px;
  color: var(--text);
  font-size: 13px;
}
.settings-nav .nav-link.active {
  color: var(--green);
  background: var(--green-soft);
  box-shadow: none;
}
.settings-nav .nav-link:hover {
  background: var(--hover);
}
.settings-form {
  min-width: 0;
}
.settings-form .panel {
  margin-bottom: 30px;
}
.settings-form .panel-header {
  display: block;
  padding: 0 0 12px;
}
.settings-form .panel-header p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  padding: 20px 0 5px;
}
.field-grid .wide {
  grid-column: 1/-1;
}
.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.settings-status {
  font-size: 12px;
  color: var(--muted);
}
.callout,
.notice {
  padding: 12px 15px;
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 18px;
}
.callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.callout p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.notice {
  color: var(--warn);
  background: var(--raised);
}
#notice {
  margin-top: 15px;
}
.progress-context {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.inline-progress .progress-context {
  margin-top: 4px;
  font-size: 10px;
}
.audit-explanation,
.recognition-notes {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--raised);
  border: 1px solid var(--line);
}
.audit-explanation.pass {
  background: color-mix(in srgb, var(--green-strong) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--green-strong) 38%, var(--line));
}
.audit-explanation.warning {
  background: color-mix(in srgb, var(--warn) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 38%, var(--line));
}
.audit-explanation h3,
.recognition-notes h3 {
  margin: 0 0 4px;
  font-size: 13px;
}
.audit-explanation p,
.recognition-notes p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 12px;
}
.audit-explanation p {
  margin-bottom: 0;
  color: var(--text);
}
.measure {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font-size: 12px;
}
.measure caption {
  caption-side: top;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.measure th {
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.measure td {
  padding: 5px 10px 5px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  color: var(--text);
  vertical-align: top;
}
.measure td:nth-child(2),
.measure td:nth-child(3) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.measure td:nth-child(3) {
  color: var(--muted);
}
.measure tr:last-child td {
  border-bottom: 0;
}
.measure tr.over td:nth-child(2) {
  color: var(--warn);
  font-weight: 600;
}
.recognition-notes ul {
  margin: 0;
  padding-left: 18px;
}
.recognition-notes {
  padding: 0;
}
.recognition-notes summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.recognition-notes summary::-webkit-details-marker {
  display: none;
}
.recognition-notes summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}
.recognition-notes[open] summary::before {
  transform: rotate(45deg);
}
.recognition-count {
  min-width: 22px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.recognition-notes-body {
  padding: 0 16px 14px 33px;
}
.detail-actions {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  margin: 22px -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -8px 18px -16px rgb(0 0 0 / 45%);
}
.api-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
  gap: 45px;
}
.api-grid .panel-body > p {
  font-size: 13px;
}
.api-key {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}
.api-key input {
  font-family: ui-monospace, Consolas, monospace;
}
.code-block,
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    12px/1.7 ui-monospace,
    Consolas,
    monospace;
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 13px;
  margin: 12px 0;
}
.endpoint {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.endpoint code {
  color: var(--text);
  overflow-wrap: anywhere;
}
.endpoint p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0 45px;
}
.method {
  display: inline-block;
  width: 45px;
  color: var(--green);
  font:
    11px ui-monospace,
    Consolas,
    monospace;
}
.method.post {
  color: var(--warn);
}
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.login-brand {
  width: min(400px, 100%);
  padding: 25px;
  text-align: center;
}
.login-brand img {
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
}
.login-brand h1 {
  font-size: 28px;
}
.login-brand > p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}
.login-foot {
  display: none;
}
.login-form {
  width: min(400px, calc(100% - 32px));
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.login-form h2 {
  font-size: 18px;
}
.login-form > p {
  font-size: 13px;
  color: var(--muted);
  margin: 7px 0 20px;
}
.login-form label {
  margin: 15px 0;
}
.login-form .button {
  width: 100%;
  margin: 5px 0;
}
.login-form .hint {
  margin: 15px 0 0;
  font-size: 12px;
}
.login-form .error-text {
  color: var(--danger);
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: min(760px, calc(100vw - 30px));
  max-height: 90dvh;
  padding: 0;
  box-shadow: var(--shadow);
}
dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
dialog::backdrop {
  background: #0007;
}
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.dialog-header h2 {
  font-size: 17px;
  overflow-wrap: anywhere;
}
#detail-content {
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}
#detail-content > p {
  margin: 12px 0 18px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.detail-list {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 11px;
  font-size: 12px;
}
.detail-list dt {
  color: var(--muted);
  font-weight: 400;
}
.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.review-box {
  border: 1px solid var(--line);
  padding: 17px;
  margin-top: 18px;
  background: var(--raised);
}
.review-box p {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 13px;
}
.review-box .button {
  margin-top: 10px;
}
.loading {
  padding: 25px 15px;
  font-size: 13px;
  color: var(--muted);
}
.mt-8 {
  margin-top: 8px;
}
.mt-12 {
  margin-top: 12px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-18 {
  margin-top: 18px;
}
.mt-20 {
  margin-top: 20px;
}
.mt-22 {
  margin-top: 22px;
}
.mt-24 {
  margin-top: 24px;
}
@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  .brand {
    padding: 0 16px;
    font-size: 23px;
  }
  .nav-link {
    padding: 10px 18px;
  }
  .worker-band {
    flex-wrap: wrap;
    gap: 12px;
  }
  .worker-media {
    flex-basis: 60%;
  }
  .worker-progress {
    width: 100%;
    order: 3;
  }
  .worker-band .actions {
    margin-left: auto;
  }
  .api-grid {
    grid-template-columns: 1fr;
  }
  .settings-layout {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 22px;
  }
  .overview-line {
    gap: 12px 20px;
  }
  .overview-line .last-sync {
    margin-left: 0;
  }
}
@media (max-width: 760px) {
  .workspace {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100dvh - 60px);
    width: 210px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
  }
  .sidebar .brand {
    display: none;
  }
  .workspace.menu-open .sidebar {
    transform: translateX(0);
  }
  .mobile-only {
    display: flex;
  }
  .topbar {
    padding: 0 15px;
    height: 60px;
    gap: 12px;
  }
  .global-search {
    min-width: 0;
  }
  .global-search kbd,
  .connection-status {
    display: none;
  }
  main {
    padding: 0 15px 25px;
  }
  .page-heading {
    margin: 0 -15px 16px;
    padding: 13px 15px;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 65px;
  }
  .page-heading h1 {
    font-size: 20px;
  }
  .page-heading .actions {
    gap: 0;
  }
  .page-heading .button:not(.primary) {
    padding: 5px 9px;
  }
  .overview-line {
    font-size: 11px;
    gap: 8px 15px;
  }
  .overview-line .last-sync {
    flex-basis: 100%;
  }
  .worker-band {
    padding: 12px;
  }
  .worker-media {
    flex-basis: 100%;
  }
  .worker-band .actions {
    margin-left: 0;
  }
  .worker-progress {
    min-width: 0;
  }
  .worker-band.idle {
    align-items: flex-start;
  }
  .worker-band.idle span {
    flex-basis: 100%;
  }
  .dashboard-split {
    grid-template-columns: 1fr;
    gap: 23px;
  }
  .dashboard-split .panel {
    margin-bottom: 0;
  }
  .dashboard-job {
    align-items: start;
  }
  .dashboard-job > div:last-child {
    align-items: flex-end;
    flex-direction: column;
  }
  .settings-layout {
    display: block;
  }
  .settings-nav {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
  }
  .settings-nav .nav-link {
    white-space: nowrap;
    min-height: 35px;
  }
  .field-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .field-grid .wide {
    grid-column: auto;
  }
  .queue-toolbar {
    gap: 9px;
  }
  .queue-toolbar input {
    max-width: none;
  }
  .queue-toolbar .hint {
    margin-left: 0;
    font-size: 11px;
  }
  .search-hero {
    flex-wrap: wrap;
    gap: 9px;
  }
  .search-hero input {
    width: calc(100% - 30px);
  }
  .search-hero select {
    width: 100%;
  }
  .callout {
    flex-wrap: wrap;
    gap: 10px;
  }
  .table-wrap table,
  .table-wrap tbody {
    display: block;
  }
  .table-wrap thead {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .table-wrap tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 12px;
    padding: 12px 9px;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap td {
    display: block;
    border: 0;
    padding: 0;
  }
  .table-wrap .title-cell {
    min-width: 0;
    max-width: none;
  }
  .table-wrap td:last-child {
    grid-column: 1/-1;
  }
  .table-wrap .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .table-wrap td:nth-child(3):not(:last-child) {
    font-size: 11px;
  }
  .inline-progress {
    max-width: 110px;
  }
  .inline-progress .progress-label {
    flex-direction: column;
    gap: 2px;
  }
  .api-key {
    flex-wrap: wrap;
  }
  .api-key input {
    flex-basis: 100%;
  }
  .detail-list {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .detail-list dd {
    margin-bottom: 10px;
  }
  .empty {
    display: block;
  }
  .empty > * + * {
    margin-top: 8px;
  }
  .panel-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .panel-header h2 {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.icon-button.mobile-only {
  display: none;
}
.sidebar .status-dot.warning {
  background: #e5bd63;
}
@media (max-width: 760px) {
  .icon-button.mobile-only {
    display: flex;
  }
}

/* Idle band: the worker can be idle, paused, or counting down a cooldown. */
.worker-band.idle .idle-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.cooldown {
  margin-top: 8px;
  max-width: 320px;
}
.cooldown progress {
  width: 100%;
}

/* Cooldown bar animates to its deadline rather than stepping on each poll. */
.cooldown .bar {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}
.cooldown .bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--green);
  width: 0;
}
.cooldown .progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.cooldown .progress-label strong {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stage-working .elapsed {
  margin-left: auto;
  font-style: normal;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Actions and finished jobs share one visible, predictable notification stack. */
.notifications {
  position: fixed;
  right: 22px;
  top: 74px;
  z-index: 65;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 44px));
  pointer-events: none;
}
.notification {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: var(--green-strong);
  color: #fff;
  box-shadow: var(--shadow);
  animation: notification-in 160ms ease-out;
}
@keyframes notification-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .notification { animation: none; } }
.notification.leaving { opacity: 0; transition: opacity 240ms ease; }
.notification strong { font-size: 12px; font-weight: 600; white-space: nowrap; color: #fff; }
.notification span { font-size: 12px; color: rgba(255, 255, 255, 0.82); overflow-wrap: anywhere; }
.notification.warning { background: var(--warn); }
.notification.error { background: var(--danger); }

/* Keep page tools in the desktop header and beside the title on small screens. */
#page-actions { flex: 1; flex-wrap: nowrap; }
.topbar .global-search { min-width: 150px; max-width: 240px; }
.topbar .button:not(.primary) {
  background: transparent;
  border-color: transparent;
  color: #f1f2f3;
}
.topbar .button:not(.primary):hover { background: #ffffff18; }
.topbar :focus-visible, .sidebar :focus-visible { outline-color: #b8dcf0; }
@media (min-width: 761px) {
  .page-heading > .actions { display: none; }
  .topbar .connection-status { display: none; }
}
@media (max-width: 1050px) and (min-width: 761px) {
  .topbar { gap: 10px; padding: 0 16px; }
  .topbar .global-search { width: auto; min-width: 0; }
  .topbar .global-search > span:not(#search-icon), .topbar .global-search kbd { display: none; }
  .topbar .button { padding-inline: 7px; }
}
@media (max-width: 760px) {
  #page-actions { display: none; }
  .save-bar { position: static; }
  .topbar .global-search { max-width: none; }
}

.folder-help { max-width: 75ch; }
.folder-help summary { cursor: pointer; font-weight: 600; }
.folder-help p, .folder-help ul { margin-top: 12px; }
.folder-help li + li { margin-top: 10px; }
#folder-results { overflow-wrap: anywhere; }
#folder-results:empty { display: none; }
