:root {
  --primary: #1B6BFF;
  --primary-hover: #1558D6;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --text: #101828;
  --muted: #667085;
  --border: #E4E7EC;
  --success: #067647;
  --success-bg: #ECFDF3;
  --warn-bg: #FFFAEB;
  --warn-border: #FEDF89;
  --warn-text: #B54708;
  --radius: 14px;
  --actionbar-h: 68px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  padding-top: var(--actionbar-h);
}

/* ---------- 顶栏 ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--border); }

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1B6BFF, #4F9BFF);
  color: #fff;
  display: grid; place-items: center;
  font-size: 21px;
  flex: none;
}

.brand h1 { margin: 0; font-size: 18px; font-weight: 700; }
.brand-sub { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; }

.privacy-note {
  display: flex; align-items: center; gap: 8px;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid #ABEFC6;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  white-space: nowrap;
}

.privacy-note .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

/* ---------- 固定操作栏 ---------- */
.actionbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .05);
  height: var(--actionbar-h);
  display: flex;
  align-items: center;
}

.actionbar-inner {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex: none;
}
.pick-btn:hover { background: var(--primary-hover); }
.pick-icon { font-size: 16px; }

.status {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13.5px;
  min-width: 0;
}
.status.ready { color: var(--text); }
.status.error { color: #B42318; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #CBD5E1;
  flex: none;
}
.status.ready .status-dot { background: var(--success); }
.status.busy .status-dot { background: var(--primary); animation: pulse 1s infinite; }
.status.error .status-dot { background: #B42318; }

@keyframes pulse { 50% { opacity: .35; } }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .15s;
  flex: none;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { background: #C4CEDF; cursor: not-allowed; }

/* ---------- 页面 ---------- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: #fff;
  border: none;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.panel-head.static { cursor: default; }
.panel-head:not(.static):hover { background: #FAFBFE; }

.panel-title { font-weight: 700; font-size: 15px; flex: none; }

.panel-summary {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chev { color: var(--muted); font-size: 12.5px; flex: none; }

.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; flex: none; }
.legend-item b { color: #344054; font-weight: 600; }

.panel-body { padding: 0 20px 18px; border-top: 1px solid #F2F4F7; }

/* ---------- 参数表单 ---------- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 18px;
  padding-top: 16px;
}

.options-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: #475467;
}

.options-grid input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.options-grid input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 107, 255, .12);
}

.options-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #344054;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 4px 6px;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- 空状态 ---------- */
.empty-state {
  padding: 46px 24px 52px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid #F2F4F7;
}
.empty-icon { font-size: 40px; }
.empty-title { margin: 10px 0 6px; font-size: 15px; font-weight: 600; color: #344054; }
.empty-desc { margin: 0; font-size: 13px; line-height: 1.9; }
.empty-desc code {
  background: #F2F5FA;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 12.5px;
  color: #475467;
}

/* ---------- 警告 ---------- */
.warnings {
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn-text);
  padding: 12px 20px;
  font-size: 13.5px;
}
.warnings ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- 专辑卡片 ---------- */
.albums { padding: 4px 20px 18px; display: flex; flex-direction: column; gap: 12px; }

.album-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }

.album-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: #F8FAFD;
  border-bottom: 1px solid var(--border);
}

.album-cover {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: #E9EEF7;
  display: grid; place-items: center;
  font-size: 17px;
  flex: none;
}

.album-title { font-weight: 700; font-size: 14px; }
.album-meta { color: var(--muted); font-size: 12px; }
.album-count { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.album-tracks { width: 100%; border-collapse: collapse; }

.album-tracks td { padding: 7px 14px; border-bottom: 1px solid #F2F4F7; font-size: 13.5px; vertical-align: middle; }
.album-tracks tr:last-child td { border-bottom: none; }
.album-tracks tr:hover { background: #FCFDFF; }
.album-tracks td.idx { width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; }
.album-tracks td.track-artist { width: 170px; }
.album-tracks td.track-file { width: 220px; color: #98A2B3; font-size: 12px; }
.album-tracks td.track-action { width: 54px; text-align: right; }

.editable {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 7px;
  min-width: 50px;
  outline: none;
  transition: border-color .12s, background .12s;
}
.editable:hover { border-color: var(--border); background: #fff; }
.editable:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(27, 107, 255, .1); }

.remove-track {
  border: none;
  background: none;
  color: #B42318;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  opacity: 0;
  transition: opacity .12s;
  padding: 3px 6px;
  border-radius: 6px;
}
.album-tracks tr:hover .remove-track { opacity: 1; }
.remove-track:hover { background: #FEF3F2; }

/* ---------- 表格预览 ---------- */
.table-scroll {
  overflow: auto;
  max-height: 440px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 14px;
}

#preview-table { border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
#preview-table th {
  position: sticky; top: 0;
  background: #F2F5FA;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid #E9EDF5;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: #344054;
}
#preview-table td {
  border-bottom: 1px solid #F2F4F7;
  border-right: 1px solid #F7F9FC;
  padding: 7px 12px;
  color: #1D2939;
}
#preview-table tr:nth-child(even) td { background: #FCFDFF; }

/* ---------- 拖拽遮罩 ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(27, 107, 255, .10);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
}
.drop-overlay.active { display: flex; }

.drop-card {
  background: #fff;
  border: 2px dashed var(--primary);
  border-radius: 18px;
  padding: 34px 56px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .16);
}
.drop-icon { font-size: 40px; }
.drop-card p { margin: 10px 0 0; font-size: 15px; font-weight: 600; color: var(--primary); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(8px);
  background: #101828;
  color: #fff;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 60;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 底部 ---------- */
.footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 28px;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .actionbar { height: auto; padding: 10px 0; }
  body { padding-top: 116px; }
  .actionbar-inner { flex-wrap: wrap; gap: 10px; padding: 0 16px; }
  .status { order: 3; flex-basis: 100%; font-size: 12.5px; }
  .page { padding: 16px; }
  .album-tracks td.track-file { display: none; }
  .legend { display: none; }
}
