:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #303133;
  background: #f5f7fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --blue: #409eff;
  --blue-dark: #337ecc;
  --ink: #303133;
  --muted: #606266;
  --faint: #909399;
  --line: #e4e7ed;
  --panel: #fff;
  --canvas: #f5f7fa;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button { color: inherit; }
.workspace { width: min(100%, 1480px); min-width: 0; margin: 0 auto; padding: 0 24px 32px; }
.topbar { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 18px; line-height: 1.4; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.mode-pill, .demo-label { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 3px; background: #ecf5ff; color: #337ecc; font-size: 12px; }
.text-button, .plain-button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); cursor: pointer; font-size: 13px; }
.text-button { border-color: transparent; }
.plain-button:hover:not(:disabled), .text-button:hover { color: var(--blue); border-color: #c6e2ff; background: #ecf5ff; }
.hidden { display: none !important; }
.notice { margin: 18px 0; padding: 10px 14px; border: 1px solid #f3d19e; border-radius: 4px; background: #fdf6ec; color: #8a6d3b; font-size: 13px; line-height: 1.5; }
.notice.error { border-color: #fde2e2; background: #fef0f0; color: #c45656; }

.login-panel { width: min(100%, 420px); margin: 64px auto 0; padding: 28px 30px 24px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); box-shadow: 0 2px 8px rgb(0 0 0 / 4%); }
.login-panel h2 { margin: 0 0 22px; font-size: 18px; font-weight: 500; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label, .filter-bar label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.login-form input, .filter-bar input, .filter-bar select { width: 100%; min-width: 0; height: 36px; padding: 0 11px; border: 1px solid #dcdfe6; border-radius: 4px; outline: none; background: #fff; color: var(--ink); font-size: 13px; transition: border-color .15s ease; }
.login-form input::placeholder, .filter-bar input::placeholder { color: #c0c4cc; }
.login-form input:hover, .filter-bar input:hover, .filter-bar select:hover { border-color: #c0c4cc; }
.login-form input:focus, .filter-bar input:focus, .filter-bar select:focus { border-color: var(--blue); }
.primary-button { min-height: 36px; padding: 0 16px; border: 1px solid var(--blue); border-radius: 4px; background: var(--blue); color: #fff; font-size: 13px; cursor: pointer; }
.primary-button:hover:not(:disabled) { border-color: var(--blue-dark); background: var(--blue-dark); }
.primary-button:disabled, .plain-button:disabled { opacity: .55; cursor: not-allowed; }
.fixture-button { min-height: 32px; border: 1px solid #c6e2ff; border-radius: 4px; background: #ecf5ff; color: #337ecc; font-size: 12px; cursor: pointer; }
.form-error { min-height: 0; margin: -5px 0 0; color: #f56c6c; font-size: 12px; line-height: 1.5; }

.welcome-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.welcome-row h2 { margin: 0; font-size: 16px; font-weight: 500; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(130px, .8fr) minmax(140px, .8fr) minmax(140px, .8fr) auto; align-items: end; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.filter-bar label { gap: 6px; white-space: nowrap; }
.filter-actions { display: flex; align-items: end; gap: 8px; }
.filter-actions .primary-button, .filter-actions .plain-button { min-height: 36px; }
.export-button { color: #337ecc; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, .8fr); gap: 14px; margin-top: 14px; align-items: start; }
.list-card, .detail-card { min-width: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.list-card { min-height: 350px; }
.list-heading { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.list-heading h3, .detail-top h3 { margin: 0; font-size: 14px; font-weight: 500; }
.list-heading p { margin: 0; color: var(--faint); font-size: 12px; }
.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table-scroll th { height: 40px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
.table-scroll th:first-child { width: 28%; padding-left: 16px; }
.table-scroll th:nth-child(2) { width: 18%; }
.table-scroll th:nth-child(3) { width: 22%; }
.table-scroll th:nth-child(4) { width: 16%; }
.table-scroll th:nth-child(5) { width: 16%; }
.table-scroll td { height: 54px; padding: 8px 12px; border-bottom: 1px solid #ebeef5; color: var(--muted); font-size: 13px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-scroll td:first-child { padding-left: 16px; }
.request-row { cursor: pointer; }
.request-row:hover { background: #f5f7fa; }
.request-row.selected { background: #ecf5ff; }
.request-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.song-name { display: block; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 500; text-overflow: ellipsis; }
.song-artist { display: block; margin-top: 3px; overflow: hidden; color: var(--faint); font-size: 12px; text-overflow: ellipsis; }
.to-user { color: var(--muted); }
.status-badge { display: inline-flex; min-height: 22px; align-items: center; padding: 0 7px; border-radius: 3px; background: #f4f4f5; color: #909399; font-size: 12px; white-space: nowrap; }
.status-badge.pending { background: #fdf6ec; color: #e6a23c; }
.status-badge.played { background: #f0f9eb; color: #67c23a; }
.status-badge.rejected, .status-badge.urgent { background: #fef0f0; color: #f56c6c; }
.status-badge.urgent { margin-left: 5px; }
.list-state { padding: 34px 16px; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.list-state.error { color: #f56c6c; }
.pagination { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 6px; }
.page-button { width: 30px; height: 28px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; color: var(--muted); cursor: pointer; }
.page-button:hover:not(:disabled) { border-color: #c6e2ff; color: var(--blue); }
.page-button:disabled { color: #c0c4cc; cursor: not-allowed; }

.detail-card { padding: 15px; min-height: 260px; }
.detail-top { min-height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-id { color: var(--faint); font-size: 12px; }
.detail-empty, .detail-loading { min-height: 195px; display: grid; place-items: center; color: var(--faint); font-size: 13px; text-align: center; }
.detail-empty p { margin: 0; }
.detail-body { padding-top: 14px; }
.detail-song { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.detail-song h4 { margin: 10px 0 4px; font-size: 16px; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.detail-song > p { margin: 0; color: var(--faint); font-size: 13px; }
.detail-facts { display: grid; gap: 10px; margin: 0; padding: 14px 0; }
.detail-facts > div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 1.5; }
.detail-facts dt { color: var(--faint); }
.detail-facts dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.blessing-block, .reject-block { margin-top: 12px; }
.block-label { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.blessing-text { min-height: 42px; margin: 0; padding: 10px; border: 1px solid #ebeef5; border-radius: 4px; background: #fafafa; color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.reject-block .blessing-text { border-color: #fde2e2; background: #fef0f0; color: #c45656; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 1080px) {
  .workspace { padding-right: 18px; padding-left: 18px; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-card { min-height: 0; }
  .detail-empty, .detail-loading { min-height: 110px; }
}
@media (max-width: 620px) {
  .workspace { padding: 0 12px 22px; }
  .topbar { min-height: 54px; }
  .topbar h1 { font-size: 16px; }
  .login-panel { margin-top: 28px; padding: 22px 18px; }
  .welcome-row { min-height: 56px; }
  .filter-bar { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
  .filter-actions { grid-column: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-actions > * { width: 100%; padding-right: 6px; padding-left: 6px; }
  .list-heading { min-height: 52px; padding: 0 12px; }
  .table-scroll { overflow: visible; }
  .table-scroll table, .table-scroll tbody { display: block; width: 100%; }
  .table-scroll thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .table-scroll tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px 10px 5px; border-bottom: 1px solid #ebeef5; }
  .table-scroll td, .table-scroll td:first-child { min-width: 0; height: auto; display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: start; gap: 6px; padding: 6px 4px; border: 0; white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
  .table-scroll td:first-child { grid-column: 1 / -1; grid-template-columns: 1fr; padding-top: 5px; padding-bottom: 8px; }
  .table-scroll td::before { content: attr(data-label); color: var(--faint); font-size: 11px; }
  .table-scroll td:first-child::before { display: none; }
  .song-name, .song-artist { overflow-wrap: anywhere; }
  .pagination { min-height: 44px; padding: 0 12px; }
  .detail-card { padding: 12px; }
}
@media (max-width: 360px) {
  .workspace { padding-right: 9px; padding-left: 9px; }
  .table-scroll tr { grid-template-columns: minmax(0, 1fr); }
  .table-scroll td:not(:first-child) { grid-template-columns: 64px minmax(0, 1fr); }
  .table-scroll td:first-child { grid-column: 1; }
}
