:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #627084;
  --line: #dde3ea;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --accent: #137c6b;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --blue: #175cd3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #eef2f6;
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f6;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(23, 32, 42, 0.08);
}

.auth-card h1 {
  font-size: 22px;
}

.auth-card p {
  color: var(--muted);
  line-height: 1.65;
}

.auth-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.auth-tab {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(23, 32, 42, 0.08);
}

.auth-form {
  width: 100%;
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form button {
  margin-top: 4px;
}

.admin-page {
  max-width: 980px;
  margin: 0 auto;
}

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

.admin-user {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  min-width: 16px;
  height: 16px;
  padding: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button svg {
  width: 17px;
  height: 17px;
}

button .lucide-loader-circle {
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.app {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 6px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #132a3a 0%, #137c6b 72%);
  color: white;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  right: -3px;
  top: -3px;
  border-radius: 999px;
  background: #f6c85f;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 9px;
  bottom: 7px;
  width: 18px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-top: 0;
  border-left: 0;
  transform: rotate(-18deg);
  border-radius: 0 0 12px 0;
}

.brand-mark {
  font-size: 15px;
  z-index: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  justify-content: flex-start;
  background: transparent;
  color: var(--muted);
  width: 100%;
}

.nav-item.active {
  background: #e7f4f1;
  color: #065f52;
}

main {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.topbar p,
.panel-head p,
.muted {
  color: var(--muted);
  margin-top: 6px;
}

.ghost {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

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

.user-badge {
  display: grid;
  gap: 2px;
  min-width: 130px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.user-badge span {
  color: var(--muted);
  font-size: 12px;
}

.user-badge strong {
  color: var(--ink);
  font-size: 13px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 14px;
}

label span {
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 11px;
  color: var(--ink);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.task-list {
  display: grid;
  gap: 12px;
}

.empty {
  padding: 28px;
  text-align: center;
  background: var(--soft);
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
}

.task-card,
.log-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.task-card {
  cursor: pointer;
}

.task-card.active {
  border-color: #14957f;
  box-shadow: 0 0 0 3px #d8f2ed;
}

.task-row,
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.task-title-row,
.detail-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-pill i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 8px;
}

.status-pill.active {
  color: var(--ok);
  background: #ecfdf3;
  border-color: #abefc6;
}

.status-pill.active i {
  background: var(--ok);
}

.status-pill.stopped {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecdca;
}

.status-pill.stopped i {
  background: var(--danger);
}

.status-pill.failed {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecdca;
}

.status-pill.failed i {
  background: var(--danger);
}

.task-run-error {
  display: grid;
  gap: 4px;
  margin: 14px 0;
  padding: 12px 14px;
  color: #912018;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 7px;
}

.task-run-error span {
  line-height: 1.55;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef4ff;
  color: #175cd3;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #c7d7fe;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip,
.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: #eef2f6;
  color: #344054;
}

.count-badge {
  justify-content: center;
  min-width: 34px;
  border-radius: 999px;
  background: #e7f4f1;
  color: #065f52;
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric {
  background: var(--soft);
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  padding: 10px;
}

.metric b {
  display: block;
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.reason-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #344054;
}

.link {
  color: var(--blue);
  text-decoration: none;
  word-break: break-all;
}

.secondary {
  background: #ffffff;
  color: #344054;
  border: 1px solid var(--line);
}

.danger-button {
  color: var(--danger);
  border-color: #fecdca;
  background: #fffafa;
}

.compact {
  min-height: 34px;
  padding: 0 10px;
}

.icon-only {
  width: 40px;
  padding: 0;
  flex: 0 0 40px;
}

.history-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.detail-panel {
  min-height: 520px;
}

.detail-head,
.label-row,
.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.detail-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.queue-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
}

.screening-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr) 18px) minmax(90px, 1fr);
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #dce7e3;
  border-radius: 7px;
  background: #fbfdfc;
}

.screening-summary > div {
  display: grid;
  justify-items: center;
  gap: 1px;
}

.screening-summary b {
  font-size: 17px;
}

.screening-summary span {
  color: var(--muted);
  font-size: 11px;
}

.screening-summary > svg {
  width: 15px;
  height: 15px;
  color: #9ba7a3;
}

.screening-summary .final b {
  color: var(--accent);
}

.mobile-export-note {
  display: none;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #fedf89;
  border-radius: 6px;
  background: #fffaeb;
  color: #93370d;
  font-size: 13px;
}

.lyric-block {
  display: grid;
  gap: 10px;
}

.label-row > span {
  font-size: 14px;
  font-weight: 700;
  color: #344054;
}

.label-row > div > span {
  font-size: 14px;
  font-weight: 700;
  color: #344054;
}

.form-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.matching-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.matching-card-title > span {
  font-size: 14px;
  font-weight: 700;
  color: #344054;
}

.field-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.field-state.required {
  color: #b42318;
  background: #fff1f0;
}

.field-state.optional {
  color: #667085;
  background: #f2f4f7;
}

.lyric-inputs {
  display: grid;
  gap: 10px;
}

.inline-input {
  display: flex;
  gap: 8px;
}

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

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.selection-options {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.extra-info-option {
  padding: 7px 10px;
  border: 1px solid #f2d06b;
  border-radius: 7px;
  background: #fff8d7;
  color: #7a5a00;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.checkline {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.checkline span {
  font-weight: 600;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  table-layout: fixed;
}

.result-table th:nth-child(1),
.result-table td:nth-child(1) {
  width: 46px;
}

.result-table th:nth-child(2),
.result-table td:nth-child(2) {
  width: 230px;
}

.result-table th:nth-child(3),
.result-table td:nth-child(3) {
  width: 105px;
}

.result-table th:nth-child(4),
.result-table td:nth-child(4) {
  width: 78px;
}

.result-table th:nth-child(5),
.result-table td:nth-child(5) {
  width: 92px;
}

.result-table th:nth-child(6),
.result-table td:nth-child(6) {
  width: 72px;
}

.result-table th:nth-child(7),
.result-table td:nth-child(7) {
  width: 76px;
}

.result-table th:nth-child(8),
.result-table td:nth-child(8) {
  width: 114px;
}

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

th {
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
}

td a {
  display: block;
  color: var(--blue);
  font-size: 12px;
  text-decoration: none;
  margin-top: 5px;
  word-break: break-all;
}

.result-copyright {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.select-col {
  width: 62px;
  text-align: center;
}

.hit-line {
  display: inline-flex;
  max-width: 360px;
  margin: 0 6px 6px 0;
  padding: 5px 7px;
  border-radius: 6px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
}

.result-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: #eef2f6;
  color: #344054;
}

.result-status.claiming,
.result-status.complaining {
  background: #fffaeb;
  color: #b54708;
}

.result-status.whitelist {
  background: #ecfdf3;
  color: #067647;
}

.result-status.catalog,
.result-status.claim_succeeded {
  background: #ecfdf3;
  color: #067647;
}

.result-status.claim_failed,
.result-status.complaint_failed {
  background: #fef3f2;
  color: #b42318;
}

.result-status.complaint_succeeded {
  background: #f2f4f7;
  color: #475467;
}

.action-cell button {
  width: 100%;
  white-space: nowrap;
}

.sub-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.sub-panel-head,
.whitelist-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sub-panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.whitelist-list {
  display: grid;
  gap: 10px;
}

.whitelist-item {
  padding: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  background: var(--soft);
}

.compact-empty {
  padding: 18px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #17202a;
  color: white;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    gap: 12px;
    align-items: center;
    overflow-x: auto;
  }

  nav {
    display: flex;
    min-width: max-content;
  }

  .brand {
    padding-bottom: 0;
    min-width: 210px;
  }

  main {
    padding: 16px;
  }

  .form-grid,
  .metrics,
  .summary-grid,
  .history-layout {
    grid-template-columns: 1fr;
  }

  .topbar,
  .top-actions,
  .task-row,
  .panel-head,
  .detail-head,
  .label-row,
  .table-toolbar,
  .queue-note,
  .sub-panel-head,
  .whitelist-item {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  body {
    background: #ffffff;
  }

  .app {
    min-height: 100dvh;
  }

  .sidebar {
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-width: 154px;
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .brand span,
  .topbar p,
  .panel-head p {
    display: none;
  }

  .nav-item {
    min-height: 36px;
    padding: 0 10px;
    white-space: nowrap;
  }

  main {
    padding: 12px;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 17px;
  }

  h3 {
    font-size: 15px;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .top-actions {
    width: 100%;
    align-items: stretch;
  }

  .user-badge {
    min-width: 0;
  }

  .panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 14px 0;
  }

  .panel-head {
    padding: 0 0 12px;
    margin-bottom: 12px;
  }

  .form-grid {
    gap: 12px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
  }

  .form-actions button,
  .detail-actions button,
  .ghost {
    width: 100%;
  }

  .history-layout {
    gap: 12px;
  }

  .task-card {
    padding: 12px;
  }

  .task-card.active {
    box-shadow: 0 0 0 2px #d8f2ed;
  }

  .task-title-row,
  .detail-title-line {
    align-items: flex-start;
  }

  .count-badge {
    align-self: flex-start;
  }

  .chips {
    gap: 5px;
  }

  .chip {
    max-width: 100%;
  }

  .detail-panel {
    min-height: 0;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric b {
    font-size: 16px;
  }

  .queue-note {
    align-items: flex-start;
  }

  .mobile-export-note {
    display: block;
  }

  .table-toolbar {
    display: flex;
    align-items: stretch;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
  }

  .table-wrap {
    border: 0;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  table,
  .result-table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f6;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

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

  .select-col {
    display: grid;
    width: 100%;
    text-align: left;
  }

  .hit-line {
    max-width: 100%;
    margin: 0 0 5px;
  }

  td[data-label="操作"] button {
    width: 100%;
  }

  .bulk-actions,
  .bulk-actions button {
    width: 100%;
  }

  .sub-panel {
    padding: 12px;
  }

  .whitelist-item {
    padding: 10px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 14px;
    max-width: none;
  }
}

/* Desktop navigation and master-detail layout */
.nav-item.active {
  background: var(--accent);
  color: #ffffff;
}

.nav-item.active:not(:disabled):hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid var(--line);
}

.sidebar-footer .user-badge {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-footer .user-badge span {
  font-size: 11px;
}

.sidebar-footer .user-badge strong {
  margin-top: 1px;
  font-size: 14px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.sidebar-actions .icon-action {
  width: 100%;
}

.topbar {
  justify-content: flex-start;
}

.history-layout {
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
}

.history-list-panel {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-list-panel .panel-head {
  align-items: flex-start;
}

.history-list-panel .history-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.history-run-all {
  width: 100%;
  min-height: 44px;
  color: var(--accent);
  border-color: #b9d9d2;
  background: #f7fcfa;
}

.history-run-all:not(:disabled):hover {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.history-list-panel .task-list {
  grid-template-columns: 1fr;
}

.history-list-panel .task-title-row h3 {
  max-width: 160px;
}

.history-detail-panel {
  min-width: 0;
}

.history-detail-panel .table-wrap {
  overflow-x: auto;
}

@media (max-width: 1080px) and (min-width: 761px) {
  .history-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .history-list-panel .task-card-meta {
    display: grid;
    justify-items: start;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: relative;
  }

  .sidebar-footer {
    position: absolute;
    top: 11px;
    right: 14px;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .sidebar-footer .user-badge {
    display: none;
  }

  .sidebar-actions {
    display: flex;
    gap: 6px;
  }

  .sidebar-actions .icon-action {
    width: 38px;
  }

  .history-list-panel .panel-head p,
  .task-card .task-time,
  .task-card .chips,
  .detail-rule,
  .summary-grid,
  .queue-note {
    display: none;
  }

  .screening-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 12px;
    padding: 0;
  }

  .screening-summary > div {
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto;
    justify-items: start;
    min-height: 62px;
    padding: 9px 10px;
  }

  .screening-summary > div > svg {
    display: block;
    grid-row: 1 / 3;
    width: 18px;
    height: 18px;
  }

  .screening-summary span {
    font-size: 10px;
  }

  .nav-item.active,
  .nav-item.active:not(:disabled):hover {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .history-layout {
    display: block;
  }

  .history-list-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .history-detail-panel {
    display: none;
  }

  body.history-detail-open .history-list-panel {
    display: none;
  }

  body.history-detail-open .history-detail-panel {
    display: block;
  }
}

/* Keep result actions visible inside narrow desktop webviews such as Feishu. */
@media (max-width: 1120px) {
  .history-detail-panel .table-wrap {
    overflow: visible;
    border: 0;
  }

  .result-table,
  .result-table tbody,
  .result-table tr,
  .result-table td {
    display: block;
    width: 100%;
  }

  .result-table {
    min-width: 0;
  }

  .result-table thead {
    display: none;
  }

  .result-table tbody {
    display: grid;
    gap: 10px;
  }

  .result-table tr {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  .result-table td {
    padding: 11px 13px;
  }

  .result-table td::before {
    display: none;
  }

  .result-select-cell {
    position: absolute;
    top: 13px;
    right: 13px;
    z-index: 1;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .result-song-cell {
    padding-right: 48px !important;
  }

  .result-song-cell > strong,
  .mobile-result-artist,
  .result-copyright {
    display: block;
  }

  .mobile-result-artist {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
  }

  .mobile-result-meta > span:not(.result-status) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 23px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f0f3f2;
    color: #56635f;
    font-size: 11px;
  }

  .mobile-result-meta svg {
    width: 12px;
    height: 12px;
  }

  .result-artist-cell,
  .result-platform-cell,
  .result-date-cell,
  .result-favorite-cell,
  .result-status-cell {
    display: none !important;
  }

  .result-action-cell {
    padding-top: 0 !important;
  }

  .result-action-cell button {
    width: 100%;
  }
}

@media (max-width: 1120px) {
  .history-detail-panel .table-wrap {
    overflow: visible;
    border: 0;
  }

  .result-table,
  .result-table tbody,
  .result-table tr,
  .result-table td {
    display: block;
    width: 100%;
  }

  .result-table {
    min-width: 0;
  }

  .result-table thead {
    display: none;
  }

  .result-table tbody {
    display: grid;
    gap: 10px;
  }

  .result-table tr {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  .result-table td {
    padding: 11px 13px;
  }

  .result-table td::before {
    display: none;
  }

  .result-select-cell {
    position: absolute;
    top: 13px;
    right: 13px;
    z-index: 1;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .result-song-cell {
    padding-right: 48px !important;
  }

  .result-song-cell > strong,
  .mobile-result-artist,
  .result-copyright {
    display: block;
  }

  .mobile-result-artist {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
  }

  .mobile-result-meta > span:not(.result-status) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 23px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f0f3f2;
    color: #56635f;
    font-size: 11px;
  }

  .mobile-result-meta svg {
    width: 12px;
    height: 12px;
  }

  .result-artist-cell,
  .result-platform-cell,
  .result-date-cell,
  .result-favorite-cell,
  .result-status-cell {
    display: none !important;
  }

  .result-action-cell {
    padding-top: 0 !important;
  }

  .result-action-cell button {
    width: 100%;
  }
}

/* Final compact mobile history rules */
@media (max-width: 760px) {
  .history-list-panel .panel-head p,
  .task-card .task-time,
  .task-card .chips,
  .detail-rule,
  .summary-grid,
  .queue-note {
    display: none;
  }

  body .history-detail-panel .screening-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 12px;
    padding: 0;
  }

  body .history-detail-panel .screening-summary > div {
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto;
    justify-items: start;
    min-height: 62px;
    padding: 9px 10px;
  }

  body .history-detail-panel .screening-summary > div > svg {
    display: block;
    grid-row: 1 / 3;
    width: 18px;
    height: 18px;
  }

  body .history-detail-panel .screening-summary span {
    font-size: 10px;
  }
}

/* Independent screening metrics and paged task history */
.screening-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.screening-summary > div {
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  justify-items: start;
  align-items: center;
  column-gap: 9px;
  min-height: 70px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f8;
}

.screening-summary > div > svg {
  grid-row: 1 / 3;
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.screening-summary b {
  line-height: 1.1;
}

.screening-summary span {
  white-space: nowrap;
}

.screening-summary .final {
  border-color: #afd4cc;
  background: var(--accent-soft);
}

.task-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.task-pagination .icon-action {
  width: 32px;
  min-height: 32px;
}

.task-pagination span b {
  color: var(--ink);
}

@media (max-width: 760px) {
  .history-list-panel .panel-head p,
  .task-card .task-time,
  .task-card .chips,
  .detail-rule,
  .summary-grid,
  .queue-note {
    display: none;
  }

  .task-list {
    gap: 8px;
  }

  .task-card {
    padding: 12px 13px;
  }

  .task-card-meta {
    margin-top: 7px;
  }

  .screening-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 12px;
  }

  .screening-summary > div {
    min-height: 62px;
    padding: 9px 10px;
  }

  .screening-summary > div > svg {
    display: block;
    width: 18px;
    height: 18px;
  }

  .screening-summary span {
    font-size: 10px;
  }

  .detail-head > div > p:last-child {
    margin-top: 6px;
    font-size: 12px;
  }

  .task-pagination {
    position: sticky;
    bottom: 82px;
    z-index: 2;
    width: max-content;
    margin: 4px auto 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-sm);
  }
}

.nav-item {
  position: relative;
}

.nav-alert {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: #d92d20;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.user-management-panel {
  min-height: 560px;
}

.user-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.user-stat {
  display: grid;
  gap: 3px;
  min-height: 76px;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid #e1e7e4;
  border-radius: 8px;
  background: #f8faf9;
}

.user-stat b {
  font-size: 21px;
}

.user-stat span {
  color: var(--muted);
  font-size: 12px;
}

.user-stat.pending b {
  color: var(--warn);
}

.user-stat.running b {
  color: #067647;
}

.user-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.search-input {
  position: relative;
}

.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input input {
  padding-left: 36px;
}

.managed-user-list {
  display: grid;
  gap: 10px;
}

.managed-user-card {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.managed-user-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 15px;
}

.managed-user-card.needs-review {
  border-left: 3px solid #f0a43c;
}

.managed-user-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #056255;
  font-size: 15px;
  font-weight: 800;
}

.managed-user-copy {
  min-width: 0;
}

.managed-user-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.managed-user-title strong {
  font-size: 15px;
}

.managed-user-copy > p {
  margin-top: 3px;
  color: #53615d;
  font-size: 13px;
  word-break: break-all;
}

.managed-user-copy .managed-user-meta {
  color: var(--muted);
  font-size: 11px;
}

.managed-user-facts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 7px;
  color: #53615d;
  font-size: 11px;
}

.managed-user-facts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.managed-user-facts svg {
  width: 13px;
  height: 13px;
}

.managed-user-facts .is-running {
  color: #067647;
  font-weight: 700;
}

.self-tag,
.username-tag,
.role-tag,
.user-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.self-tag {
  background: #eef2f6;
  color: #475467;
}

.username-tag {
  background: #f2f4f7;
  color: #667085;
  font-weight: 600;
}

.role-tag {
  background: #f2f4f7;
  color: #475467;
}

.role-tag.superadmin {
  background: #fff4e5;
  color: #934f08;
}

.role-tag.admin {
  background: #eef4ff;
  color: #175cd3;
}

.user-status.pending {
  background: #fffaeb;
  color: #93370d;
}

.user-status.approved {
  background: #ecfdf3;
  color: #067647;
}

.user-status.rejected {
  background: #fef3f2;
  color: #b42318;
}

.managed-user-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  flex: 0 0 auto;
}

.protected-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.protected-note svg {
  width: 15px;
  height: 15px;
}

.role-button {
  color: #175cd3;
  border-color: #c7d7fe;
  background: #f8faff;
}

.observe-button {
  color: #056255;
  border-color: #b9ddd6;
  background: #f5fbf9;
}

.managed-user-editor,
.managed-task-panel {
  padding: 15px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

.managed-editor-head,
.managed-task-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.managed-editor-head > div,
.managed-task-panel-head > div {
  display: grid;
  gap: 3px;
}

.managed-editor-head strong,
.managed-task-panel-head strong {
  font-size: 14px;
}

.managed-editor-head span,
.managed-task-panel-head span {
  color: var(--muted);
  font-size: 11px;
}

.managed-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.managed-editor-note {
  grid-column: 1 / -1;
}

.managed-editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.managed-editor-actions button {
  width: auto;
}

.managed-task-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.managed-task-stats > span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 9px 11px;
  border: 1px solid #e1e7e4;
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
}

.managed-task-stats b {
  color: var(--ink);
  font-size: 17px;
}

.managed-task-stats .running {
  border-color: #abefc6;
  background: #ecfdf3;
}

.managed-task-stats .running b {
  color: #067647;
}

.managed-task-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.managed-task-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(170px, auto) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-bottom: 1px solid #edf0ef;
}

.managed-task-row:last-child {
  border-bottom: 0;
}

.managed-task-name,
.managed-task-time {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.managed-task-name strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-task-name span,
.managed-task-time span {
  color: var(--muted);
  font-size: 10px;
}

.managed-task-time b {
  color: #475467;
  font-size: 11px;
  font-weight: 600;
}

.managed-task-statuses {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.task-observe-status,
.task-execution-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.task-observe-status.active,
.task-execution-status.running {
  background: #ecfdf3;
  color: #067647;
}

.task-observe-status.stopped,
.task-execution-status.idle {
  background: #f2f4f7;
  color: #475467;
}

.task-execution-status.queued {
  background: #fffaeb;
  color: #93370d;
}

.task-execution-status.failed,
.managed-task-error {
  color: #b42318;
}

.managed-task-error {
  margin-bottom: 10px;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .managed-user-card-row {
    flex-direction: column;
    align-items: stretch;
  }

  .managed-user-actions {
    padding-top: 11px;
    border-top: 1px solid #edf0ef;
  }
}

.admin-return-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 7px;
  text-decoration: none;
}

@media (max-width: 760px) {
  body.manager-mode nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-alert {
    position: absolute;
    top: 2px;
    left: calc(50% + 8px);
    margin: 0;
  }

  .user-management-panel .panel-head {
    align-items: center;
  }

  .user-management-panel .panel-head p {
    display: none;
  }

  .user-management-panel .panel-head button {
    width: auto;
    flex: 0 0 auto;
  }

  .user-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .user-stat {
    min-height: 68px;
  }

  .user-toolbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .managed-user-card-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 13px;
  }

  .managed-user-main {
    align-items: flex-start;
  }

  .managed-user-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 10px;
    border-top: 1px solid #edf0ef;
  }

  .managed-user-actions .role-button,
  .managed-user-actions .protected-note {
    grid-column: 1 / -1;
  }

  .managed-user-actions button {
    width: 100%;
  }

  .managed-editor-head,
  .managed-task-panel-head {
    align-items: flex-start;
  }

  .managed-editor-grid {
    grid-template-columns: 1fr;
  }

  .managed-editor-note {
    grid-column: auto;
  }

  .managed-task-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .managed-task-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .managed-task-statuses {
    justify-content: flex-start;
  }

  .screening-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 10px 7px;
  }

  .screening-summary > svg {
    display: none;
  }

  .screening-summary b {
    font-size: 16px;
  }

  .screening-summary span {
    font-size: 10px;
    white-space: nowrap;
  }
}

/* 2026 workspace refresh */
:root {
  --ink: #18211f;
  --muted: #66736f;
  --line: #dfe5e2;
  --soft: #f5f7f6;
  --panel: #ffffff;
  --accent: #087565;
  --accent-hover: #066355;
  --accent-soft: #e5f3ef;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --warn: #a15c06;
  --ok: #067647;
  --blue: #175cd3;
  --shadow-sm: 0 1px 2px rgba(24, 33, 31, 0.05);
  --shadow-md: 0 10px 28px rgba(24, 33, 31, 0.07);
}

body {
  background: #f2f5f4;
  color: var(--ink);
  line-height: 1.5;
}

button {
  min-height: 42px;
  border-radius: 7px;
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

button:not(:disabled):hover {
  background: var(--accent-hover);
}

button.secondary:not(:disabled):hover,
button.ghost:not(:disabled):hover {
  background: var(--soft);
  border-color: #bdc9c5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(8, 117, 101, 0.16);
  outline-offset: 1px;
  border-color: var(--accent);
}

.app {
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.brand {
  min-width: 0;
  padding: 0 8px 26px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  background: #0b6f61;
  font-size: 15px;
}

.brand-mark::before {
  display: none;
}

.brand-mark::after {
  display: none;
}

.auth-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

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

.brand strong {
  font-size: 16px;
}

.brand span {
  font-size: 11px;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 7px;
  color: #596661;
}

.nav-item.active {
  background: var(--accent-soft);
  color: #056255;
}

main {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 26px 30px 40px;
}

.topbar {
  min-height: 58px;
  margin-bottom: 20px;
}

.page-heading h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.page-heading p {
  max-width: 720px;
  margin-top: 4px;
  font-size: 13px;
}

.top-actions {
  flex-direction: row;
  width: auto;
  align-items: center;
  gap: 8px;
}

.user-badge {
  min-width: 150px;
  padding: 7px 11px;
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
}

.icon-action {
  width: 42px;
  padding: 0;
}

.icon-action span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.panel {
  padding: 22px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 18px;
}

.panel-head p {
  max-width: 720px;
  font-size: 13px;
}

.schedule-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #c8e4dc;
  border-radius: 999px;
  background: #f0faf7;
  color: #066355;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.schedule-note svg {
  width: 15px;
  height: 15px;
}

.task-form {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e3e8e5;
  border-radius: 8px;
  background: #fbfcfc;
}

.form-section-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.form-section-head h3 {
  font-size: 15px;
}

.form-section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.step-index {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border-radius: 50%;
  background: #dceee9;
  color: #056255;
  font-size: 12px;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(280px, 1.6fr) minmax(170px, 0.8fr);
  gap: 14px;
}

@media (min-width: 1121px) {
  #create .form-section {
    grid-template-columns: minmax(175px, 0.24fr) minmax(0, 1fr);
    align-items: start;
    column-gap: 24px;
  }

  #create .form-section-head {
    grid-column: 1;
  }

  #create .field-grid,
  #create .matching-grid {
    grid-column: 2;
  }
}

label {
  gap: 6px;
  font-size: 13px;
}

input,
select,
textarea {
  min-height: 42px;
  border-color: #cfd8d4;
  border-radius: 7px;
  padding: 9px 11px;
  box-shadow: inset 0 1px 1px rgba(24, 33, 31, 0.02);
}

.matching-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.matching-card {
  align-content: start;
  min-height: 150px;
  padding: 15px;
  border: 1px solid #dfe5e2;
  border-radius: 8px;
  background: #ffffff;
}

.matching-card.featured {
  border-color: #badbd2;
  background: #fbfefd;
}

.label-row {
  flex-direction: row;
  align-items: flex-start;
}

.label-row .compact {
  flex: 0 0 auto;
  min-height: 32px;
  white-space: nowrap;
}

.form-actions {
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
}

.form-actions p {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.form-actions p svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.form-actions button[type="submit"] {
  min-width: 150px;
}

.history-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.history-list-panel {
  position: static;
  max-height: none;
  overflow: visible;
}

.task-list {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.task-card {
  padding: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.task-card:hover {
  border-color: #b9c8c3;
  box-shadow: var(--shadow-sm);
}

.task-card.active {
  border-color: #63a99c;
  background: #fbfefd;
  box-shadow: 0 0 0 3px rgba(8, 117, 101, 0.09);
}

.task-row {
  flex-direction: row;
}

.task-card-main {
  min-width: 0;
}

.task-title-row h3 {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.task-time {
  margin-top: 8px;
  font-size: 12px;
}

.result-count {
  display: grid;
  flex: 0 0 54px;
  justify-items: end;
  line-height: 1.15;
}

.result-count b {
  color: #075f53;
  font-size: 20px;
}

.result-count small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.chips {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #edf0ef;
}

.chip {
  gap: 5px;
  min-height: 24px;
  padding: 0;
  background: transparent;
  color: #6b7773;
}

.chip svg {
  width: 13px;
  height: 13px;
}

.detail-panel {
  min-width: 0;
  min-height: 560px;
}

.result-table {
  min-width: 820px;
}

.result-table th:nth-child(1),
.result-table td:nth-child(1) {
  width: 46px;
}

.result-table th:nth-child(2),
.result-table td:nth-child(2) {
  width: 230px;
}

.result-table th:nth-child(3),
.result-table td:nth-child(3) {
  width: 105px;
}

.result-table th:nth-child(4),
.result-table td:nth-child(4) {
  width: 78px;
}

.result-table th:nth-child(5),
.result-table td:nth-child(5) {
  width: 92px;
}

.result-table th:nth-child(6),
.result-table td:nth-child(6) {
  width: 72px;
}

.result-table th:nth-child(7),
.result-table td:nth-child(7) {
  width: 76px;
}

.result-table th:nth-child(8),
.result-table td:nth-child(8) {
  width: 114px;
}

.mobile-back,
.mobile-result-meta,
.mobile-result-artist {
  display: none;
}

.detail-head {
  flex-direction: row;
}

.detail-rule {
  max-width: 680px;
}

.detail-actions {
  flex-direction: row;
  flex-wrap: wrap;
}

.summary-grid {
  gap: 8px;
}

.metric {
  min-height: 68px;
  padding: 11px 12px;
  border: 0;
  border-radius: 7px;
  background: #f5f7f6;
}

.metric b {
  font-size: 19px;
}

.queue-note {
  align-items: center;
  border-color: #dce7e3;
  background: #f7faf9;
}

.table-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 0;
  background: #ffffff;
}

.table-wrap {
  border-radius: 8px;
}

th {
  background: #f6f8f7;
}

.sub-panel {
  border-radius: 8px;
  background: #fbfcfc;
}

.auth-gate {
  background: #eff3f1;
}

.auth-card {
  gap: 15px;
  padding: 30px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

@media (max-width: 1120px) and (min-width: 761px) {
  .app {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  main {
    padding: 22px;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-head {
    flex-direction: column;
  }

  .detail-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  body {
    background: #f4f7f6;
  }

  .app {
    display: block;
    min-height: 100dvh;
    padding-bottom: 76px;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: 62px;
    padding: 11px 15px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-width: 0;
    padding: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand span {
    display: block;
    font-size: 10px;
  }

  nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    min-width: 0;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -6px 18px rgba(24, 33, 31, 0.06);
  }

  .nav-item {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px 8px;
    border-radius: 7px;
    font-size: 11px;
  }

  .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .nav-item.active {
    background: transparent;
    color: var(--accent);
  }

  main {
    width: 100%;
    padding: 0 14px 24px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    min-height: 58px;
    margin: 0 -14px 14px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
  }

  .page-heading h1 {
    font-size: 17px;
  }

  .page-heading p {
    display: none;
  }

  .top-actions {
    flex-direction: row;
    width: auto;
    gap: 6px;
  }

  .user-badge {
    display: none;
  }

  .icon-action,
  .ghost.icon-action {
    width: 38px;
    min-height: 38px;
    padding: 0;
  }

  .panel {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: none;
  }

  .panel-head,
  .create-panel-head {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .panel-head p {
    display: block;
    font-size: 12px;
    line-height: 1.55;
  }

  .schedule-note {
    display: none;
  }

  .task-form {
    gap: 12px;
  }

  .form-section {
    gap: 14px;
    padding: 14px;
    border-radius: 8px;
    background: #f9fbfa;
  }

  .field-grid,
  .matching-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .matching-card {
    min-height: 0;
    padding: 13px;
  }

  .label-row {
    flex-direction: row;
    align-items: flex-start;
  }

  .inline-input {
    align-items: stretch;
  }

  .inline-input .icon-only {
    width: 44px;
    min-height: 44px;
    flex-basis: 44px;
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .form-actions p {
    justify-content: center;
  }

  .form-actions button[type="submit"] {
    width: 100%;
    min-height: 48px;
  }

  .history-layout {
    display: block;
  }

  .task-list {
    grid-template-columns: 1fr;
  }

  .history-list-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .history-detail-panel {
    display: none;
  }

  body.history-detail-open .history-list-panel {
    display: none;
  }

  body.history-detail-open .history-detail-panel {
    display: block;
  }

  .mobile-back {
    display: inline-flex;
    width: auto;
    min-height: 36px;
    margin-bottom: 14px;
    padding: 0 10px;
  }

  .task-card {
    padding: 13px;
  }

  .task-row {
    flex-direction: row;
  }

  .task-title-row h3 {
    max-width: 230px;
  }

  .detail-head {
    flex-direction: column;
  }

  .detail-title-line {
    gap: 7px;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .detail-actions button {
    width: 100%;
  }

  .detail-actions button:last-child {
    grid-column: 1 / -1;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .queue-note {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .table-toolbar {
    position: static;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9f8;
  }

  .bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .bulk-actions .muted {
    grid-column: 1 / -1;
  }

  .bulk-actions button {
    width: 100%;
  }

  .table-wrap {
    width: 100%;
    overflow: visible;
  }

  .result-table {
    width: 100%;
    min-width: 0;
  }

  .result-table tbody {
    gap: 12px;
  }

  .result-table tr {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }

  .result-table td {
    display: block;
    width: 100%;
    padding: 11px 13px;
  }

  .result-table td::before {
    display: none;
  }

  .result-select-cell {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .result-select-cell input {
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
  }

  .result-song-cell {
    padding-right: 46px !important;
  }

  .result-song-cell > strong {
    display: block;
    font-size: 15px;
  }

  .mobile-result-artist {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
  }

  .mobile-result-meta > span:not(.result-status) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 23px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f0f3f2;
    color: #56635f;
    font-size: 11px;
  }

  .mobile-result-meta svg {
    width: 12px;
    height: 12px;
  }

  .result-song-cell a {
    margin-top: 8px;
  }

  .result-artist-cell,
  .result-platform-cell,
  .result-date-cell,
  .result-favorite-cell,
  .result-status-cell {
    display: none !important;
  }

  .result-match-cell {
    background: #fcfdfd;
  }

  .result-match-cell::before {
    content: "命中歌词";
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .result-action-cell button {
    width: 100%;
  }

  .sub-panel {
    padding: 13px;
  }

  .sub-panel-head,
  .whitelist-item {
    flex-direction: row;
  }

  .whitelist-item .link {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-gate {
    align-items: start;
    padding: 24px 14px;
  }

  .auth-card {
    padding: 22px;
  }
}

/* Final responsive navigation overrides */
.nav-item.active {
  background: var(--accent);
  color: #ffffff;
}

.nav-item.active:not(:disabled):hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid var(--line);
}

.sidebar-footer .user-badge {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sidebar-footer .user-badge span {
  font-size: 11px;
}

.sidebar-footer .user-badge strong {
  margin-top: 1px;
  font-size: 14px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.sidebar-actions .icon-action {
  width: 100%;
}

.topbar {
  justify-content: flex-start;
}

.history-layout {
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
}

.history-list-panel {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-list-panel .panel-head {
  align-items: flex-start;
}

.history-list-panel .task-list {
  grid-template-columns: 1fr;
}

.history-list-panel .task-title-row h3 {
  max-width: 160px;
}

.history-detail-panel {
  min-width: 0;
}

.history-detail-panel .table-wrap {
  overflow-x: auto;
}

@media (max-width: 1080px) and (min-width: 761px) {
  .history-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: relative;
  }

  .sidebar-footer {
    position: absolute;
    top: 11px;
    right: 14px;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .sidebar-footer .user-badge {
    display: none;
  }

  .sidebar-actions {
    display: flex;
    gap: 6px;
  }

  .sidebar-actions .icon-action {
    width: 38px;
  }

  .nav-item.active,
  .nav-item.active:not(:disabled):hover {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .history-layout {
    display: block;
  }

  .history-list-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .history-detail-panel {
    display: none;
  }

  body.history-detail-open .history-list-panel {
    display: none;
  }

  body.history-detail-open .history-detail-panel {
    display: block;
  }
}

@media (max-width: 1120px) {
  .history-detail-panel .table-wrap {
    overflow: visible;
    border: 0;
  }

  .result-table {
    min-width: 0;
  }

  .result-table td {
    width: 100% !important;
  }

  .result-table .result-select-cell {
    width: auto !important;
  }

  .mobile-result-artist {
    display: block;
  }

  .mobile-result-meta {
    display: flex;
  }
}

.site-record {
  display: block;
  padding: 22px 16px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.site-record a,
a.site-record {
  color: inherit;
  text-decoration: none;
}

.site-record a:hover,
a.site-record:hover {
  color: var(--accent);
  text-decoration: underline;
}

.auth-gate {
  position: relative;
  padding-bottom: 64px;
}

.auth-site-record {
  position: absolute;
  right: 0;
  bottom: 16px;
  left: 0;
  padding: 8px 16px;
}

body.monitor-confirm-open {
  overflow: hidden;
}

.monitor-confirm[hidden] {
  display: none;
}

.monitor-confirm {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.monitor-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(5px);
}

.monitor-confirm-card {
  position: relative;
  width: min(480px, 100%);
  padding: 32px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 24px;
  background: var(--panel, #fff);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.monitor-confirm-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 16px;
  color: var(--accent);
  background: var(--accent-soft);
}

.monitor-confirm-icon svg {
  width: 25px;
  height: 25px;
}

.monitor-confirm-eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.monitor-confirm-copy {
  max-width: 410px;
  margin: 0 auto;
}

.monitor-confirm-card h2 {
  margin: 0;
  font-size: 24px;
}

.monitor-confirm-copy > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.monitor-confirm-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
}

.monitor-confirm-summary span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface, #f8fafc);
  font-size: 13px;
  font-weight: 650;
}

.monitor-confirm-summary svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.monitor-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.monitor-confirm-actions button {
  flex: 1 1 0;
  min-height: 48px;
  justify-content: center;
}

.task-execution-status.completed {
  color: #047857;
  background: #ecfdf5;
}

@media (max-width: 560px) {
  .monitor-confirm {
    align-items: end;
    padding: 12px;
  }

  .monitor-confirm-card {
    padding: 26px 18px 18px;
    border-radius: 20px;
  }

  .monitor-confirm-summary,
  .monitor-confirm-actions {
    grid-template-columns: 1fr;
  }

  .monitor-confirm-actions {
    display: grid;
  }

  .monitor-confirm-actions button {
    width: 100%;
    justify-content: center;
  }
}
