:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1b232d;
  --border: #2a3441;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #35d08b;
  --accent-strong: #2bb878;
  --danger: #f0616d;
  --warning: #e3b341;
  --blue: #58a6ff;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(53, 208, 139, .12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(88, 166, 255, .08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.hidden { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .01em; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 18px; }
p { margin: 0; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 20px; font-size: 13px; }
.warning { color: var(--warning); font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* login */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(380px, 100%);
  background: linear-gradient(180deg, rgba(27, 35, 45, .96), rgba(21, 27, 35, .96));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #1f9d68);
  color: #062016;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(53, 208, 139, .25);
}

.auth-card h1 { margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 24px; font-size: 13px; }
.auth-card .field { text-align: left; display: block; margin-bottom: 16px; }
.auth-card .field span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12.5px; }

/* shell */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(13, 17, 23, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(42, 52, 65, .8);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(135deg, var(--accent), #1f9d68);
  color: #062016; font-weight: 800;
}
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.account-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.account-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--border); }
.account-text { display: flex; flex-direction: column; line-height: 1.15; }
.account-text strong { font-size: 12.5px; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text small { color: var(--muted); font-size: 10.5px; }

main {
  width: min(1120px, 100%);
  margin: 26px auto 80px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: linear-gradient(180deg, rgba(23, 29, 37, .92), rgba(20, 26, 33, .92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
}

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.job-actions { display: flex; align-items: center; gap: 10px; }

.row { display: flex; gap: 10px; }
.row input { flex: 1; }

input[type="text"], input[type="password"], input[type="number"] {
  background: #0f151c;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: rgba(53, 208, 139, .7); box-shadow: 0 0 0 3px rgba(53, 208, 139, .12); }
input[type="number"] { width: 74px; padding: 7px 9px; }

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform .1s, background .15s, opacity .15s;
  white-space: nowrap;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: #062016; font-weight: 650; }
.primary:hover { background: #4ade9a; }
.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.ghost:hover { background: var(--surface-2); }
.danger { background: rgba(240, 97, 109, .14); color: var(--danger); border: 1px solid rgba(240, 97, 109, .35); }
.danger:hover { background: rgba(240, 97, 109, .22); }
.wide { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); border-radius: 999px;
  padding: 4px 10px; font-size: 11.5px; font-weight: 600;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge.ok { color: var(--accent); border-color: rgba(53, 208, 139, .35); background: rgba(53, 208, 139, .1); }
.badge.bad { color: var(--danger); border-color: rgba(240, 97, 109, .35); background: rgba(240, 97, 109, .1); }
.badge.busy { color: var(--blue); border-color: rgba(88, 166, 255, .35); background: rgba(88, 166, 255, .1); }

.preview { display: grid; grid-template-columns: 168px 1fr; gap: 20px; margin-top: 18px; align-items: start; }
.preview > img { width: 168px; height: 168px; object-fit: cover; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.preview-body { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.options { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin: 4px 0 6px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--accent); }
.limit { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 7px; }

.progress { height: 7px; border-radius: 999px; background: #0b1015; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--border); }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width .35s ease; }

.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: #121820; color: var(--muted);
  text-align: left; font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 9px 12px; border-bottom: 1px solid rgba(42, 52, 65, .55); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
.col-index { width: 44px; }
.col-status { width: 92px; }
.col-quality { width: 92px; }
.col-output { width: 210px; }

.song-title { font-weight: 600; }
.song-artist { color: var(--muted); font-size: 11.5px; }
.item-error { color: var(--danger); font-size: 11.5px; margin-top: 3px; word-break: break-word; }
.path { color: var(--muted); font-size: 11.5px; word-break: break-all; }

.st-done, .st-skipped { color: var(--accent); }
.st-failed, .st-unavailable { color: var(--danger); }
.st-downloading, .st-transcoding, .st-tagging, .st-checking { color: var(--blue); }
.st-pending { color: var(--muted); }
.st-canceled, .st-interrupted { color: var(--warning); }

.settings dl { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; margin: 0; }
.settings dt { color: var(--muted); }
.settings dd { margin: 0; word-break: break-all; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }

/* modal */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(5, 8, 11, .72);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal-card {
  position: relative;
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin-bottom: 6px; }
.modal-card > .muted { font-size: 12.5px; margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 10px; right: 12px;
  background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; padding: 4px 8px;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.qr-box {
  width: 240px; height: 240px; margin: 0 auto 16px;
  display: grid; place-items: center;
  background: #fff; border-radius: 12px; padding: 10px;
}
.qr-box img, .qr-box canvas { display: block; width: 220px !important; height: 220px !important; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 80;
  background: #1d2631; border: 1px solid var(--border);
  color: var(--text); border-radius: 10px;
  padding: 11px 18px; font-size: 13px;
  box-shadow: var(--shadow);
  max-width: min(560px, 90vw);
}
.toast.error { color: #ffd7da; border-color: rgba(240, 97, 109, .45); }

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; align-items: flex-start; }
  .header-right { gap: 7px; }
  main { padding: 0 14px; margin-top: 18px; }
  .card { padding: 17px; }
  .preview { grid-template-columns: 110px 1fr; gap: 14px; }
  .preview > img { width: 110px; height: 110px; }
  .col-output { display: none; }
  .account-text { display: none; }
  .account-chip { padding: 3px; }
}
