:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17201d;
  background: #f5f7f6;
  font-synthesis: none;
  letter-spacing: 0;
  --ink: #17201d;
  --muted: #66736e;
  --line: #dce3e0;
  --surface: #ffffff;
  --surface-soft: #f5f7f6;
  --brand: #126a4a;
  --brand-dark: #0c5138;
  --blue: #245f91;
  --amber: #9a650d;
  --red: #b4232f;
  --red-soft: #fff0f1;
  --green-soft: #eaf7f1;
  --focus: #77a995;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--surface-soft);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-inner,
.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.brand strong {
  font-size: 15px;
  line-height: 1.25;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #ffffff;
  background: var(--brand);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.brand-mark-large {
  width: 48px;
  height: 48px;
  margin-inline: auto;
}

.brand-mark-large svg {
  width: 24px;
  height: 24px;
}

.page-shell {
  padding-block: 34px 64px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.3;
}

.user-label {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
}

.user-label svg {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.notice {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 10px 13px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 13px;
}

.notice svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.notice-success {
  border-color: #b9ddcd;
  color: #0b5d3d;
  background: var(--green-soft);
}

.notice-error {
  border-color: #efc4c8;
  color: #91212a;
  background: var(--red-soft);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 30px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.stat-item {
  min-width: 0;
  padding: 17px 18px;
  border-right: 1px solid var(--line);
}

.stat-item:last-child {
  border-right: 0;
}

.stat-item span,
.stat-item strong {
  display: block;
}

.stat-item span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stat-item strong {
  font-size: 24px;
  line-height: 1.15;
}

.stat-positive strong {
  color: var(--brand);
}

.stat-muted strong {
  color: #6d7773;
}

.stat-accent strong {
  color: var(--blue);
}

.stat-warning strong {
  color: var(--amber);
}

.library-section {
  width: 100%;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.library-toolbar > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-bar {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.checkbox-control,
.row-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-control {
  gap: 7px;
  color: #3d4b45;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.checkbox-control input,
.row-checkbox input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.checkbox-control input:disabled {
  cursor: not-allowed;
}

.selected-count {
  flex: 0 0 auto;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.button-compact {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 11px;
}

.button:disabled {
  border-color: #dce2e0;
  color: #a0a9a5;
  background: #f1f3f2;
  cursor: not-allowed;
}

.search-field {
  position: relative;
  width: 300px;
}

.search-field > svg,
.field-with-icon > svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: #7a8581;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input,
.field-with-icon input {
  width: 100%;
  height: 38px;
  border: 1px solid #cfd8d4;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}

.search-field input {
  padding: 0 38px 0 36px;
}

.search-field input::placeholder,
.field-with-icon input::placeholder {
  color: #98a19d;
}

.search-clear {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
}

.search-clear:hover {
  background: #edf1ef;
}

.search-clear svg {
  width: 15px;
  height: 15px;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
}

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

.button-primary {
  color: #ffffff;
  background: var(--brand);
}

.button-primary:hover {
  background: var(--brand-dark);
}

.button-secondary {
  border-color: #cfd8d4;
  color: #34403b;
  background: var(--surface);
}

.button-secondary:hover {
  border-color: #abb9b3;
  background: #f7f9f8;
}

.button-danger {
  color: #ffffff;
  background: var(--red);
}

.button-danger:hover {
  background: #921d27;
}

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

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

.song-table th,
.song-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e8edeb;
  text-align: left;
  vertical-align: middle;
}

.song-table th {
  height: 42px;
  padding-block: 10px;
  color: #64706b;
  background: #f7f9f8;
  font-size: 11px;
  font-weight: 700;
}

.song-table th:nth-child(1) {
  width: 4%;
}

.song-table th:nth-child(2) {
  width: 28%;
}

.song-table th:nth-child(3) {
  width: 23%;
}

.song-table th:nth-child(4) {
  width: 10%;
}

.song-table th:nth-child(5) {
  width: 12%;
}

.song-table th:nth-child(6) {
  width: 23%;
}

.song-table tbody tr:last-child td {
  border-bottom: 0;
}

.song-table tbody tr:hover {
  background: #fbfcfc;
}

.song-hidden {
  background: #fafafa;
}

.song-hidden .song-identity strong,
.song-hidden .file-name {
  color: #79827f;
}

.song-identity {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.song-identity > div {
  min-width: 0;
}

.song-identity strong,
.song-identity span,
.file-name {
  display: block;
}

.song-identity strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-identity div > span {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-id {
  min-width: 32px;
  flex: 0 0 32px;
  padding-top: 1px;
  color: #77817d;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.selection-heading,
.select-cell {
  text-align: center !important;
}

.row-checkbox {
  width: 30px;
  height: 30px;
  justify-content: center;
  border-radius: 5px;
}

.row-checkbox:hover {
  background: #eef3f1;
}

.file-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.format-tag {
  min-width: 38px;
  flex: 0 0 auto;
  padding: 3px 5px;
  border: 1px solid #ccd8d3;
  border-radius: 4px;
  color: #496058;
  background: #f3f7f5;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: #52605a;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lyrics-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #3e4c46;
  font-size: 12px;
}

.lyrics-missing {
  color: #8c9591;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #b8c0bd;
}

.status-dot-green {
  background: #2c9269;
}

.state-badge {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.state-badge svg {
  width: 13px;
  height: 13px;
}

.state-active {
  border-color: #b8ddcd;
  color: #0f6847;
  background: #edf8f3;
}

.state-hidden {
  border-color: #d5dad8;
  color: #6b7471;
  background: #f2f4f3;
}

.state-error {
  border-color: #efc4c8;
  color: #91212a;
  background: var(--red-soft);
}

.actions-heading {
  text-align: right !important;
}

.actions-cell {
  text-align: right !important;
}

.action-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.action-group form {
  margin: 0;
}

.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #53615b;
  background: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.icon-button:hover {
  border-color: #d4ddda;
  color: var(--ink);
  background: #f2f5f4;
}

.icon-button-danger {
  color: var(--red);
}

.icon-button-danger:hover {
  border-color: #efc6ca;
  color: #921d27;
  background: var(--red-soft);
}

.empty-state {
  height: 220px;
  color: var(--muted);
  text-align: center !important;
}

.empty-state svg,
.empty-state strong {
  display: block;
  margin-inline: auto;
}

.empty-state svg {
  width: 26px;
  height: 26px;
  margin-bottom: 10px;
}

.empty-state strong {
  font-size: 13px;
}

.confirm-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(18, 32, 27, 0.22);
}

.confirm-dialog::backdrop {
  background: rgba(13, 23, 20, 0.48);
}

.dialog-content {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding: 22px;
}

.dialog-content h2 {
  margin-bottom: 7px;
  font-size: 17px;
}

.dialog-content p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.dialog-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--red);
  background: var(--red-soft);
}

.dialog-icon svg {
  width: 20px;
  height: 20px;
}

.dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.report-shell {
  width: min(940px, calc(100% - 40px));
}

.report-heading {
  align-items: center;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 28px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.report-summary > div {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.report-summary > div:last-child {
  border-right: 0;
}

.report-summary span,
.report-summary strong {
  display: block;
}

.report-summary span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

.report-summary strong {
  font-size: 24px;
}

.report-success strong {
  color: var(--brand);
}

.report-failed strong {
  color: var(--red);
}

.report-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

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

.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.report-table th,
.report-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e8edeb;
  text-align: left;
}

.report-table th {
  color: #64706b;
  background: #f7f9f8;
  font-size: 11px;
}

.report-table th:nth-child(1) {
  width: 42%;
}

.report-table th:nth-child(2) {
  width: 18%;
}

.report-table tbody tr:last-child td {
  border-bottom: 0;
}

.report-table td:last-child {
  color: var(--muted);
  font-size: 12px;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3f1;
}

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

.login-panel {
  padding: 30px;
  border: 1px solid #d7dfdc;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 38px rgba(21, 42, 34, 0.08);
}

.product-name {
  margin: 12px 0 3px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.login-panel h1 {
  margin-bottom: 24px;
  font-size: 22px;
  text-align: center;
}

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

.login-form label {
  margin-top: 5px;
  color: #4f5c57;
  font-size: 12px;
  font-weight: 650;
}

.field-with-icon {
  position: relative;
}

.field-with-icon input {
  height: 42px;
  padding: 0 12px 0 38px;
}

.login-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .stat-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-item:nth-child(3) {
    border-right: 0;
  }

  .stat-item:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .library-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-form,
  .search-field {
    width: 100%;
  }

  .search-form .button {
    flex: 0 0 auto;
  }

  .bulk-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .bulk-actions {
    width: 100%;
    margin-left: 0;
    padding-top: 7px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .topbar-inner,
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .page-shell {
    padding-block: 24px 44px;
  }

  .page-heading {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  h1 {
    font-size: 24px;
  }

  .user-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stat-strip {
    grid-template-columns: repeat(2, 1fr);
    margin-inline: -12px;
  }

  .stat-item,
  .stat-item:nth-child(3) {
    border-right: 1px solid var(--line);
  }

  .stat-item:nth-child(even) {
    border-right: 0;
  }

  .stat-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .stat-item:last-child {
    border-right: 1px solid var(--line);
  }

  .bulk-bar {
    margin-inline: -1px;
  }

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

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

  .search-form {
    align-items: stretch;
  }

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

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

  .song-table thead {
    display: none;
  }

  .song-table tr {
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
  }

  .song-table td {
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
  }

  .song-table td::before {
    content: attr(data-label);
    flex: 0 0 42px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .song-table td:first-child {
    padding-block: 0;
  }

  .song-table td:first-child::before {
    display: none;
  }

  .song-table tr {
    position: relative;
  }

  .song-table .select-cell {
    position: absolute;
    z-index: 2;
    top: 8px;
    left: 8px;
    width: 34px;
    min-height: 34px;
    padding: 0;
    border: 0;
  }

  .song-table .select-cell::before {
    display: none;
  }

  .song-table .song-cell {
    padding-left: 50px;
  }

  .song-identity {
    width: 100%;
  }

  .file-cell {
    max-width: calc(100% - 58px);
  }

  .actions-cell {
    text-align: left !important;
  }

  .action-group {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .empty-state::before {
    display: none;
  }

  .report-shell {
    width: min(100% - 24px, 940px);
  }

  .report-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-summary {
    margin-inline: -12px;
  }

  .report-summary > div {
    padding: 15px 12px;
  }

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

  .report-table thead {
    display: none;
  }

  .report-table tr {
    border-bottom: 1px solid var(--line);
  }

  .report-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #eef1f0;
  }

  .report-table td::before {
    content: attr(data-label);
    flex: 0 0 42px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .login-body {
    align-items: start;
    padding-top: 48px;
  }

  .login-panel {
    padding: 26px 22px;
  }
}

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