/* ───── Theme theo THE C.I.U Brand Guideline 2026 – giống hr.theciu.vn (nhánh feat/hrm):
   đen #010101, trắng, kem #FFF9F5 / #FFFDF0, vàng bơ #FFE197 / #FDECA6; Montserrat (tiêu đề) + Poppins (nội dung) ───── */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fff9f5;        /* kem: hover, ô nhập */
  --surface-3: #f3ece4;        /* nền thanh tua, ảnh chưa có bìa */
  --soft: #fffcf8;
  --side: #fff9f5;             /* thanh bên */
  --border: #ece5dd;
  --text: #010101;
  --muted: #67615b;
  --subtle: #9a938c;
  --primary: #010101;          /* nút chính, nút phát */
  --on-primary: #ffffff;
  --butter: #ffe197;           /* mục đang chọn */
  --butter-light: #fdeca6;
  --butter-deep: #c99a1e;
  --cream-light: #fffdf0;
  --active-bg: var(--butter);
  --active-text: #010101;
  --accent: var(--primary);    /* tên cũ, giữ để không phải sửa nhiều chỗ */
  --accent-soft: var(--butter);
  --ok: #1a7f37;  --ok-soft: #e3f5e8;
  --err: #c62a2f; --err-soft: #fde8e8;
  --warn: #a35f00; --warn-soft: #fff1dc;
  --shadow: 0 6px 24px rgba(1,1,1,.10), 0 1px 3px rgba(1,1,1,.06);
  --cover: linear-gradient(135deg, #fdeca6, #ffe197 55%, #f6cf6c);
  --cover-ink: rgba(1,1,1,.45);
  --radius: 8px;
  --sidebar-w: 260px;
  --player-h: 84px;
  --font: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: Montserrat, Poppins, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
[data-mode="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1b1b1b;
  --surface-3: #2a2a2a;
  --soft: #171717;
  --side: #111111;
  --border: #2a2a2a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --subtle: #8a8580;
  --primary: #f4f4f5;          /* nền tối: màu chính đảo thành trắng */
  --on-primary: #0a0a0a;
  --cream-light: #1b1a16;
  --active-bg: rgba(255, 225, 151, .14);
  --active-text: #ffe197;
  --accent-soft: rgba(255, 225, 151, .14);
  --ok: #4ac26b;  --ok-soft: #12301d;
  --err: #ff6b6f; --err-soft: #3a1717;
  --warn: #f0a24a; --warn-soft: #3a2412;
  --shadow: 0 12px 32px rgba(0,0,0,.55);
  --cover: linear-gradient(135deg, #3a3220, #2a2414 60%, #1d1a12);
  --cover-ink: rgba(255,225,151,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- brand ---------- */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 4px 10px; color: var(--text); }
.brand-logo { display: block; height: 18px; width: auto; }
[data-mode="dark"] .brand-logo { filter: invert(1); }
.brand-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); line-height: 1.2; }
.brand-lg { align-items: center; gap: 8px; }
.brand-lg .brand-logo { height: 24px; }
.brand-lg .brand-sub { font-size: 11.5px; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
  background: var(--surface); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); opacity: .82; }
.btn-soft { background: var(--butter); border-color: var(--butter); color: #010101; }
.btn-soft:hover { background: var(--butter-light); border-color: var(--butter-light); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); border-color: transparent; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--err); border-color: var(--err); opacity: .9; }
.btn-block { width: 100%; }
.btn .i { width: 16px; height: 16px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.icon-btn.toggle.on { color: var(--text); background: var(--active-bg); }
.icon-btn.toggle.on::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--text); }

.field input, .field textarea, .field select, .input {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  min-height: 36px; padding: 7px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--subtle); }
.field input:focus, .field textarea:focus, .field select:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-weight: 500; font-size: 12.5px; margin-bottom: 4px; }
.form-error { color: var(--err); min-height: 20px; margin: -6px 0 10px; font-size: 13px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--side); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px 28px; text-align: center; box-shadow: var(--shadow); }
.login-card .brand { padding: 0 0 4px; }
.login-card .muted { margin: 8px 0 22px; }
.login-card .login-hint { margin: 14px 0 0; }
.login-card .field-label { font-size: 13px; }
.text-left { text-align: left; }
.login-card .field.text-left { margin-bottom: 12px; }

/* ---------- shell ---------- */
.shell {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--player-h);
  grid-template-areas: "side main" "player player";
}
.sidebar { grid-area: side; background: var(--side); border-right: 1px solid var(--border); padding: 20px 8px 8px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.nav-title { padding: 0 10px 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px; color: var(--text); transition: background .15s; }
.nav a .i { width: 16px; height: 16px; }
.nav a:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.nav a.active { color: var(--active-text); background: var(--active-bg); font-weight: 500; }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); padding-top: 8px; }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: transparent; border-radius: 6px; text-align: left; }
.me:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.me.active { background: var(--active-bg); color: var(--active-text); }
.me.active .muted { color: inherit; opacity: .75; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-text #me-name { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--av, #67615b); display: grid; place-items: center; font-weight: 600; font-size: 12px; color: #fff; flex: none; }

.main { grid-area: main; overflow-y: auto; padding: 24px 32px 40px; background: var(--bg); min-width: 0; outline: none; }
.tabbar { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
.page-sub { margin: 6px 0 0; font-size: 13px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search { position: relative; width: 260px; max-width: 100%; }
.search .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--subtle); width: 16px; height: 16px; }
.search input { padding-left: 32px; background: var(--side); border-color: transparent; }
.search input:hover { border-color: var(--border); }
.toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- track list ---------- */
.tracks { list-style: none; margin: 0; padding: 0; }
.tracks-head, .track {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 32px minmax(0, 1fr) minmax(0, 160px) 56px 36px;
  padding: 0 12px;
}
.sortable-head, .tracks.sortable .track { grid-template-columns: 20px 32px minmax(0, 1fr) minmax(0, 160px) 56px 36px; }
.tracks-head { height: 38px; color: var(--muted); font-size: 12px; font-weight: 500; background: var(--soft); border: 1px solid var(--border); border-radius: 8px 8px 0 0; margin-bottom: 4px; }
.track { min-height: 56px; border-radius: 6px; cursor: default; user-select: none; }
.track:hover, .track:focus-within { background: var(--soft); }
.track.playing { background: var(--cream-light); box-shadow: inset 3px 0 0 var(--butter); }
.track.dragging { opacity: .4; }
.track.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.track.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.track-num { position: relative; width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.track-num .num-play { display: none; }
.track:hover .track-num .num-text, .track:focus-within .track-num .num-text { display: none; }
.track:hover .track-num .num-play, .track:focus-within .track-num .num-play { display: grid; }
.num-play { width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); padding: 0; }
.num-play .i { width: 16px; height: 16px; }
.track-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.track-text { min-width: 0; display: flex; flex-direction: column; }
.track-title { font-weight: 500; }
.track.playing .track-title { font-weight: 600; }
.track-sub { color: var(--muted); font-size: 13px; }
.track-by, .track-dur { color: var(--muted); font-size: 13px; }
.track-dur { text-align: right; font-variant-numeric: tabular-nums; }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; opacity: .5; }
.track:hover .grip { opacity: 1; }
.grip .i { width: 16px; height: 16px; }

.thumb { width: 40px; height: 40px; border-radius: 6px; background: var(--surface-3) center/cover no-repeat; flex: none; display: grid; place-items: center; color: var(--muted); }
.thumb .i { width: 18px; height: 18px; }

.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq span { width: 3px; background: var(--butter-deep); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: -.3s; }
.eq span:nth-child(3) { animation-delay: -.6s; }
.eq.paused span { animation-play-state: paused; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty .empty-icon { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 12px; background: var(--side); color: var(--muted); display: grid; place-items: center; }
.empty .empty-icon .i { width: 24px; height: 24px; stroke-width: 1.5; }
.empty h3 { color: var(--text); margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.empty p { font-size: 13px; }
.empty p { margin: 0 0 18px; }

/* ---------- add page ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.card h2 { font-size: 16px; font-weight: 600; }
.add-grid { display: grid; gap: 20px; max-width: 860px; }
.add-input { min-height: 160px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.7; }
.add-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.add-row select { width: auto; min-width: 220px; flex: 1; max-width: 340px; }
.add-row .spacer { flex: 1; }
.counter { color: var(--muted); font-size: 13px; }
.counter b { color: var(--text); }
.skipped { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); font-size: 13px; }
.skipped ul { margin: 6px 0 0; padding-left: 18px; }
.skipped li { word-break: break-all; }

.jobs-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.jobs-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.job { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.job-status { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.job-status .i { width: 16px; height: 16px; }
.job.queued .job-status { color: var(--muted); background: var(--side); }
.job.done .job-status { color: var(--ok); background: var(--ok-soft); }
.job.error .job-status { color: var(--err); background: var(--err-soft); }
.job-title { font-weight: 500; }
.job-sub { font-size: 12px; color: var(--muted); }
.job.error .job-sub { color: var(--err); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--surface-3); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- albums ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.album-card { display: block; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); transition: background .15s, border-color .15s; text-align: left; width: 100%; }
.album-card:hover { background: var(--soft); border-color: color-mix(in srgb, var(--text) 25%, transparent); }
.album-cover { position: relative; aspect-ratio: 1; border-radius: 8px; background: var(--cover) center/cover no-repeat; display: grid; place-items: center; color: var(--cover-ink); margin-bottom: 12px; overflow: hidden; }
.album-cover .i { width: 40px; height: 40px; stroke-width: 1.5; }
.album-cover .cover-play { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; box-shadow: var(--shadow); }
.album-card:hover .cover-play, .album-card:focus-within .cover-play { opacity: 1; transform: none; }
.album-name { font-weight: 600; }
.album-new { border: 1px dashed color-mix(in srgb, var(--text) 20%, transparent); background: transparent; color: var(--muted); }
.album-new .album-cover { background: var(--side); color: var(--muted); }

.album-hero { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.album-hero .album-cover { width: 200px; flex: none; margin: 0; box-shadow: var(--shadow); }
.album-hero .eyebrow { text-transform: uppercase; font-size: 11px; letter-spacing: .14em; color: var(--muted); font-weight: 500; }
.album-hero h1 { font-size: 36px; font-weight: 700; margin: 4px 0 6px; line-height: 1.15; letter-spacing: -0.01em; word-break: break-word; }
.album-hero p { margin: 0 0 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 16px; font-weight: 500; font-size: 13px; }
.back-link:hover { color: var(--text); }
.back-link .i { width: 18px; height: 18px; }

/* ---------- player ---------- */
.player {
  grid-area: player; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center; gap: 16px; padding: 0 20px; background: var(--surface); border-top: 1px solid var(--border);
}
.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player .thumb { width: 52px; height: 52px; }
.player-meta { min-width: 0; }
.player-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.player-controls { display: flex; align-items: center; gap: 10px; }
.play-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; transition: transform .1s; }
.play-btn:hover { transform: scale(1.06); }
.play-btn .i { width: 18px; height: 18px; }
.repeat-one { position: absolute; top: 3px; right: 3px; font-size: 9px; font-weight: 700; color: var(--text); display: none; }
#p-repeat.one .repeat-one { display: block; }
.seek { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.time { font-size: 11px; color: var(--muted); width: 38px; font-variant-numeric: tabular-nums; }
.seek .time:first-child { text-align: right; }
.player-volume { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.player-volume input { width: 110px; }
.player.is-empty .player-controls, .player.is-empty .seek { opacity: .4; pointer-events: none; }
.player.is-empty .player-title { color: var(--muted); font-weight: 500; }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 16px; background: transparent; flex: 1; cursor: pointer; --p: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--text) var(--p), var(--surface-3) var(--p)); }
input[type="range"]:hover::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--butter-deep) var(--p), var(--surface-3) var(--p)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); margin-top: -4px; opacity: 0; transition: opacity .15s; }
input[type="range"]:hover::-webkit-slider-thumb, input[type="range"]:focus-visible::-webkit-slider-thumb { opacity: 1; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text); }

/* ---------- menu / modal / toast ---------- */
.menu { position: fixed; z-index: 50; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; text-align: left; font-size: 13px; }
.menu button .i { width: 16px; height: 16px; }
.menu button:hover, .menu button:focus-visible { background: var(--side); }
.menu button.danger { color: var(--err); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; animation: fade .12s ease-out; }
.modal { width: 100%; max-width: 440px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.modal.wide { max-width: 560px; }
.modal-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-body p { margin: 0 0 12px; }
.modal-foot { padding: 12px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); background: var(--soft); border-radius: 0 0 12px 12px; }
@keyframes fade { from { opacity: 0; } }

.pick-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 360px; overflow-y: auto; }
.pick-list label { display: grid; grid-template-columns: 20px 40px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; }
.pick-list label:hover { background: var(--side); }
.pick-list input { width: 16px; height: 16px; accent-color: var(--primary); }
.pick-list .in-album { opacity: .45; cursor: default; }
.album-pick { display: grid; gap: 4px; }
.album-pick button { display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; background: transparent; border-radius: 8px; text-align: left; }
.album-pick button:hover { background: var(--side); }
.album-pick .thumb { background-image: var(--cover); color: var(--cover-ink); }

.toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--player-h) + 16px); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: #010101; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow); animation: toast .2s ease-out; max-width: 90vw; }
.toast.error { background: #c62a2f; color: #fff; }
[data-mode="dark"] .toast:not(.error) { background: #f4f4f5; color: #0a0a0a; }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }

/* ---------- tài khoản ---------- */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; max-width: 820px; align-items: start; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin: 0 0 16px; }
.card-title .i { width: 18px; height: 18px; color: var(--muted); }
.card .muted.small { margin: -6px 0 12px; }
.ext-card { max-width: 820px; margin-top: 20px; }
.ext-card > .muted { margin: 0 0 12px; }
.ext-steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; }
.ext-card code, .ext-card kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--side); border: 1px solid var(--border); padding: 0 5px; border-radius: 4px; }
.account-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.field-hint { margin: -10px 0 14px; }
.cred-box { background: var(--side); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; word-break: break-all; margin: 12px 0; user-select: all; }

.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-width: 900px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.user-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 96px 130px 36px; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: var(--soft); }
.user-row .avatar { width: 36px; height: 36px; }
.user-row.is-disabled .user-main, .user-row.is-disabled .avatar { opacity: .5; }
.user-name { font-weight: 500; }
.user-last { text-align: right; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--side); border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; justify-self: start; }
.tag .i { width: 13px; height: 13px; }
.tag-accent { background: var(--butter); border-color: var(--butter-deep); color: #010101; }
[data-mode="dark"] .tag-accent { background: var(--active-bg); border-color: transparent; color: var(--butter); }
.tag-err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 30%, transparent); color: var(--err); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .tracks-head, .track { grid-template-columns: 32px minmax(0, 1fr) 56px 36px; }
  .sortable-head, .tracks.sortable .track { grid-template-columns: 20px 32px minmax(0, 1fr) 56px 36px; }
  .track-by, .tracks-head .col-by { display: none; }
}

@media (max-width: 900px) {
  :root { --player-h: 64px; --tab-h: 58px; }
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr var(--player-h) var(--tab-h); grid-template-areas: "main" "player" "tabs"; }
  .sidebar { display: none; }
  .main { padding: 18px 16px 28px; }
  .tabbar { grid-area: tabs; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; }
  .tabbar a.active { color: var(--text); font-weight: 600; }
  .tabbar a.active .i { stroke-width: 2.2; }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; }
  .player { grid-template-columns: minmax(0, 1fr) auto; padding: 0 12px; gap: 8px; position: relative; }
  .player .thumb { width: 42px; height: 42px; }
  .player-volume, #p-prev { display: none; }
  .player-controls .icon-btn { width: 34px; height: 34px; }
  .seek { position: absolute; left: 0; right: 0; top: -8px; max-width: none; }
  .seek .time { display: none; }
  .seek input::-webkit-slider-runnable-track { height: 3px; border-radius: 0; }
  .player-controls { gap: 4px; }
  .toasts { bottom: calc(var(--player-h) + var(--tab-h) + 12px); }
  .page-title { font-size: 24px; }
  .search { width: 100%; }
  .tracks-head { display: none; }
  .track, .tracks.sortable .track { padding: 0 6px; gap: 10px; }
  .track-dur { display: none; }
  .tracks-head, .track { grid-template-columns: 28px minmax(0, 1fr) 36px; }
  .tracks.sortable .track { grid-template-columns: 18px minmax(0, 1fr) 36px; }
  .tracks.sortable .track-num { display: none; }
  .track-num { width: 28px; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .album-card { padding: 8px; }
  .album-cover .cover-play { opacity: 1; transform: none; width: 38px; height: 38px; }
  .album-hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .album-hero .album-cover { width: 140px; }
  .album-hero h1 { font-size: 28px; }
  .add-row select { max-width: none; }
  .user-row { grid-template-columns: 36px minmax(0, 1fr) auto 36px; gap: 10px; }
  .user-row .user-last, .user-row .tag-spacer { display: none; }
  .user-row .tag-err { grid-column: 2; grid-row: 2; margin-top: -4px; }
  .account-grid { grid-template-columns: 1fr; }
}

/* ---------- giao diện sáng / tối ---------- */
.mode-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--side); border: 1px solid var(--border); border-radius: 8px; }
.mode-switch button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; }
.mode-switch button .i { width: 15px; height: 15px; }
.mode-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 1px 3px rgba(1,1,1,.08); }
