:root {
  --bg: #0b0c10;
  --panel: #14161d;
  --panel-2: #1b1e27;
  --line: #2a2e3a;
  --text: #eceef3;
  --muted: #9aa0b0;
  --faint: #6b7183;
  --brand: #fcb001;
  --brand-ink: #1a1200;
  --ok: #3ccf6e;
  --bad: #ff5d5d;
  --radius: 14px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
body { min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: rgba(11, 12, 16, 0.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.01em; font-size: 17px; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand small { font-weight: 600; color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 14px; }

/* ---------- layout */
.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 60px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } .wrap { padding: 16px; } .top { padding: 12px 16px; } }
.stack { display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 14px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.card h2 .sub { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); margin-left: 6px; }
.hint { color: var(--faint); font-size: 13px; margin: 8px 0 0; }
.sticky { position: sticky; top: 76px; }
@media (max-width: 960px) { .sticky { position: static; } }

/* ---------- tabs */
.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; }
.tabs button {
  border: 0; background: transparent; padding: 9px 20px; border-radius: 999px; cursor: pointer;
  font-weight: 700; color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.tabs button:disabled { cursor: not-allowed; opacity: 0.5; }

/* ---------- forms */
.fields { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.fields label { color: var(--muted); font-size: 14px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) auto 90px; gap: 10px; align-items: center; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(252, 176, 1, 0.18); }
input:disabled, select:disabled { opacity: 0.45; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.info-grid { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 18px; }
@media (max-width: 560px) { .info-grid { grid-template-columns: 1fr; } .fields { grid-template-columns: 1fr; gap: 4px 0; } .fields label { margin-top: 6px; } }

/* ---------- album art tile */
.art {
  position: relative; width: 132px; height: 132px; border-radius: 12px; border: 1.5px dashed var(--line);
  background: var(--panel-2) center/cover no-repeat; display: grid; place-items: center; text-align: center;
  color: var(--faint); font-size: 12px; cursor: pointer; overflow: hidden; transition: border-color .15s;
}
.art:hover, .art.drag { border-color: var(--brand); color: var(--text); }
.art.has { border-style: solid; }
.art.has .art-empty { display: none; }
.art .badge { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 11px; }
.art .x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; display: none; }
.art.has .x { display: block; }
.art .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand); width: 0; }

/* ---------- drop zone + file rows */
.drop {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.drag { border-color: var(--brand); background: rgba(252, 176, 1, 0.05); color: var(--text); }
.drop strong { color: var(--brand); }
.rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.rows li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.rows .num { color: var(--faint); font-family: var(--mono); font-size: 13px; text-align: right; }
.rows .name { min-width: 0; }
.rows .name .file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rows .name .sub { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rows .name input { padding: 6px 9px; }
.rows .status { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 92px; text-align: right; }
.rows .status.ok { color: var(--ok); font-weight: 700; }
.rows .status.bad { color: var(--bad); }
.rows .status.active { color: var(--brand); }
.rows .mini { height: 3px; background: var(--line); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.rows .mini i { display: block; height: 100%; width: 0; background: var(--brand); }
.icon-btns { display: flex; gap: 2px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--line); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- segmented */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--panel-2); padding: 8px 14px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.seg button:disabled { cursor: not-allowed; }

/* ---------- buttons */
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 800; cursor: pointer; }
.btn.primary { background: var(--brand); color: var(--brand-ink); width: 100%; font-size: 16px; padding: 14px; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 600; padding: 8px 14px; }
.btn.ghost:hover { border-color: var(--muted); }
.btn.dl { display: inline-flex; align-items: center; gap: 8px; background: var(--ok); color: #04210f; text-decoration: none; }

/* ---------- progress */
.progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.track { flex: 1; height: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .35s ease; }
.track.done i { background: var(--ok); }
.track.failed i { background: var(--bad); }
.pct { font-family: var(--mono); font-weight: 700; width: 48px; text-align: right; }
.status-text { color: var(--muted); margin-top: 10px; min-height: 22px; font-size: 14px; text-align: center; }
.status-text.ok { color: var(--text); }
.status-text.bad { color: var(--bad); }
.preview { margin-top: 14px; border-radius: 12px; background: #0e1018; border: 1px solid var(--line); min-height: 140px; display: grid; place-items: center; overflow: hidden; }
.preview img { width: 100%; display: block; }
.preview .empty { color: var(--faint); font-size: 13px; padding: 20px; text-align: center; }
.result-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.note { font-size: 13px; color: var(--muted); }

/* ---------- recent */
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recent li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.recent li:first-child { border-top: 0; }
.recent .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .meta { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* ---------- toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a1416; border: 1px solid var(--bad); color: #ffd7d7;
  padding: 12px 16px; border-radius: 12px; max-width: min(560px, calc(100% - 32px)); z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ---------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(252, 176, 1, 0.16), transparent 60%), var(--bg); }
.login { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login .logo { width: 64px; height: 64px; display: block; margin: 0 auto 14px; object-fit: contain; }
.login h1 { text-align: center; margin: 0; font-size: 22px; }
.login p.lead { text-align: center; color: var(--muted); margin: 6px 0 24px; font-size: 14px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.login .btn.primary { margin-top: 22px; }
.login .err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 12px; text-align: center; }

/* ---------- phones */
@media (max-width: 560px) {
  .brand small, .who { display: none; }
  .top { gap: 8px; }
  .rows li { grid-template-columns: 22px minmax(0, 1fr); row-gap: 6px; }
  .rows .status { grid-column: 2; text-align: left; min-width: 0; }
  .rows .icon-btns { grid-column: 2; justify-content: flex-start; margin-top: -4px; }
  .rows li { grid-template-areas: none; }
  .tabs { display: flex; }
  .tabs button { flex: 1; padding: 9px 10px; }
  .row2 { grid-template-columns: minmax(0, 1fr) auto 76px; }
}
