:root {
  color-scheme: dark;
  --bg: #08090d;
  --surface: #101119;
  --surface-2: #151622;
  --text: #f7f7fb;
  --muted: #9699a6;
  --line: rgba(255,255,255,.105);
  --accent: #ff5578;
  --purple: #8d58ff;
  --purple-soft: #b89bff;
  --success: #5ee3a2;
  --danger: #ff8ca3;
  --radius: 22px;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.ambient { position: fixed; z-index: -1; width: 520px; height: 520px; border-radius: 50%; filter: blur(150px); opacity: .12; pointer-events: none; }
.ambient-one { top: -260px; right: -100px; background: var(--purple); }
.ambient-two { bottom: -300px; left: -160px; background: #ff244d; }

.topbar { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 13px clamp(18px, 5vw, 68px); border-bottom: 1px solid var(--line); background: rgba(8,9,13,.9); backdrop-filter: blur(18px); }
.brand { width: max-content; display: inline-flex; align-items: center; gap: 9px; }
.brand img { display: block; width: 52px; max-height: 34px; object-fit: contain; object-position: left center; }
.brand span { color: #9d74ff; font-size: 7px; font-weight: 900; letter-spacing: .28em; }
.topbar-copy { display: grid; justify-items: center; gap: 3px; }
.topbar-copy strong { font-size: 10px; letter-spacing: .25em; }
.topbar-copy span { color: #656874; font-size: 9px; }
.site-link { justify-self: end; min-height: 36px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: #fff; font-size: 10px; font-weight: 800; }

main { width: min(calc(100% - 32px), 1120px); margin: 0 auto; padding: 56px 0 90px; }
.eyebrow { color: #ff6c8b; font-size: 9px; font-weight: 900; letter-spacing: .19em; }
h1 { margin: 12px 0 14px; font-size: clamp(40px, 5vw, 64px); line-height: .96; letter-spacing: -.052em; }
p { color: var(--muted); line-height: 1.65; }

.login-panel { width: min(100%, 470px); margin: 7vh auto 0; padding: clamp(28px, 5vw, 46px); border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(24,27,36,.96), rgba(12,13,18,.96)); box-shadow: 0 32px 90px rgba(0,0,0,.42); }
.login-mark { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 26px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), var(--purple)); color: white; font-weight: 950; letter-spacing: -.05em; box-shadow: 0 18px 42px rgba(255,49,89,.18); }
.login-panel h1 { font-size: clamp(35px, 7vw, 49px); }
.login-panel > p { margin: 0 0 25px; }
form { display: grid; gap: 12px; }
label { font-size: 11px; font-weight: 800; }
.password-row { display: grid; grid-template-columns: 1fr auto; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); }
.password-row:focus-within { border-color: rgba(141,88,255,.6); box-shadow: 0 0 0 4px rgba(141,88,255,.08); }
input { min-width: 0; padding: 15px 16px; border: 0; outline: 0; background: transparent; color: white; }
.password-row button { padding: 0 16px; border: 0; background: transparent; color: #b99eff; font-size: 11px; font-weight: 800; }
.primary-button, .secondary-button, .upload-button, .restore-button, .choose-music, .upload-music { min-height: 46px; border-radius: 12px; font-weight: 850; transition: transform .16s ease, opacity .16s ease, border-color .16s ease; }
.primary-button:hover, .secondary-button:hover, .upload-button:hover, .restore-button:hover, .choose-music:hover, .upload-music:hover { transform: translateY(-1px); }
.primary-button { margin-top: 6px; border: 0; background: linear-gradient(135deg, var(--purple), #b166ff); color: white; }
.secondary-button { padding: 0 18px; border: 1px solid var(--line); background: rgba(255,255,255,.035); color: white; }
.form-message { min-height: 22px; margin: 0; color: var(--danger); font-size: 11px; }

.dashboard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; }
.dashboard-head p { max-width: 710px; margin: 0; font-size: 13px; }
.admin-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 36px 0 44px; padding: 7px; border: 1px solid var(--line); border-radius: 18px; background: rgba(15,16,23,.7); }
.admin-tab { min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: #8e909c; text-align: left; }
.admin-tab.active { border-color: rgba(139,84,255,.48); background: linear-gradient(100deg, rgba(90,49,155,.32), rgba(112,35,93,.15)); color: #fff; }
.tab-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(141,88,255,.28); border-radius: 9px; background: rgba(141,88,255,.09); color: #bda2ff; }
.admin-tab span:last-child { display: grid; gap: 4px; }
.admin-tab strong { font-size: 12px; }
.admin-tab small { color: #666977; font-size: 9px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin-bottom: 20px; }
.section-heading h2 { margin: 8px 0 0; font-size: clamp(32px, 4vw, 44px); line-height: 1; letter-spacing: -.045em; }
.section-heading p { max-width: 580px; margin: 0; font-size: 12px; }
.notice { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; padding: 12px 14px; border: 1px solid rgba(141,88,255,.25); border-radius: 12px; background: rgba(141,88,255,.07); }
.notice-icon { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: rgba(141,88,255,.2); color: #c3adff; font-size: 10px; font-weight: 900; }
.notice div { display: grid; gap: 2px; }
.notice strong { font-size: 10px; }
.notice span { color: #838692; font-size: 9px; }

.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.media-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: rgba(16,17,25,.94); box-shadow: 0 20px 55px rgba(0,0,0,.15); }
.media-preview { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #090a0e; }
.media-preview.portrait { aspect-ratio: 4 / 5; }
.media-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-badge { position: absolute; top: 10px; left: 10px; padding: 5px 8px; border-radius: 999px; background: rgba(8,9,13,.82); color: white; font-size: 7px; font-weight: 900; letter-spacing: .08em; backdrop-filter: blur(10px); }
.media-badge.custom { color: var(--success); background: rgba(17,42,34,.84); }
.media-copy { padding: 15px; }
.media-copy h3 { margin: 0 0 7px; font-size: 15px; }
.media-copy p { min-height: 40px; margin: 0; font-size: 10px; }
.media-meta { min-height: 17px; margin-top: 9px; color: #646774; font-size: 8px; }
.media-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.upload-button { border: 0; background: #f6f5f9; color: #121219; }
.restore-button { padding: 0 12px; border: 1px solid var(--line); background: transparent; color: #d7d9e1; }
.restore-button:disabled { cursor: default; opacity: .34; transform: none; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.media-card.busy { opacity: .6; pointer-events: none; }

.music-heading { margin-bottom: 24px; }
.music-upload-layout { display: grid; grid-template-columns: 1.45fr .65fr; gap: 16px; }
.upload-card { display: grid; grid-template-columns: 34% 1fr; min-height: 260px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(15,16,24,.94); }
.upload-visual { position: relative; display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg, #19182c, #11111d); }
.upload-visual::before, .upload-visual::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(153,98,255,.3); }
.upload-visual::before { width: 170px; height: 170px; }
.upload-visual::after { width: 100px; height: 100px; }
.upload-visual span { position: relative; z-index: 2; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(145deg, #a04fff, #ff397d); color: white; font-size: 32px; box-shadow: 0 18px 50px rgba(120,58,219,.3); }
.upload-copy { align-self: center; padding: 30px; }
.upload-copy h3, .music-note-card h3, .music-library h3 { margin: 8px 0 12px; font-size: 25px; letter-spacing: -.04em; }
.upload-copy > p { margin: 0 0 7px; font-size: 11px; }
.auto-title { color: #767987 !important; }
.auto-title strong { color: #e9e6ef; }
.upload-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.choose-music { border: 1px solid var(--line); background: transparent; color: #f2f0f7; }
.upload-music { border: 0; background: linear-gradient(135deg, #7c45e7, #6a3ec5); color: #fff; }
.upload-music:disabled { cursor: default; opacity: .36; transform: none; }
.upload-note { display: block; margin-top: 10px; color: #5f6270; font-size: 8px; line-height: 1.5; }
.upload-progress, .media-upload-progress { margin-top: 14px; }
.upload-meter[hidden] { display: none; }
.upload-meter { display: grid; gap: 7px; }
.upload-meter-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #858896; font-size: 8px; line-height: 1.35; }
.upload-meter-copy strong { color: #f1edf8; font-size: 9px; font-variant-numeric: tabular-nums; }
.upload-meter-track { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.upload-meter-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), #ff4f88); box-shadow: 0 0 18px rgba(151,80,255,.42); transition: width .18s ease-out; }
.music-note-card { padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: rgba(15,16,24,.9); }
.music-note-card h3 { font-size: 20px; }
.music-note-card ol { display: grid; gap: 13px; margin: 22px 0 0; padding: 0; list-style: none; }
.music-note-card li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.music-note-card li > b { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: #b89bff; font-size: 9px; }
.music-note-card li span { display: grid; gap: 3px; }
.music-note-card li strong { font-size: 10px; }
.music-note-card li small { color: #737684; font-size: 8px; line-height: 1.5; }
.music-library { margin-top: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: rgba(15,16,24,.84); }
.library-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.library-head h3 { margin-bottom: 0; }
.library-count { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: #7d808c; font-size: 8px; }
.music-admin-list { display: grid; gap: 8px; }
.music-admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 92px 92px auto; align-items: center; gap: 12px; min-height: 62px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.075); border-radius: 13px; background: rgba(18,19,28,.76); }
.music-index { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: rgba(112,69,190,.26); color: #c5afff; font-size: 9px; font-weight: 900; }
.music-admin-info { min-width: 0; }
.music-admin-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.music-admin-info span { display: block; margin-top: 4px; color: #666976; font-size: 8px; }
.music-admin-stat { min-height: 38px; display: grid; place-items: center; align-content: center; gap: 3px; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; }
.music-admin-stat strong { font-size: 10px; }
.music-admin-stat span { color: #656875; font-size: 7px; letter-spacing: .1em; }
.music-ready { color: var(--success); font-size: 7px; font-weight: 900; letter-spacing: .13em; white-space: nowrap; }
.empty-admin { padding: 24px; border: 1px dashed var(--line); border-radius: 13px; color: #747784; text-align: center; font-size: 10px; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: min(360px, calc(100% - 40px)); padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; background: #171a22; color: white; font-size: 11px; box-shadow: 0 18px 50px rgba(0,0,0,.38); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,49,89,.45); color: #ff9caf; }

@media (max-width: 900px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .music-upload-layout { grid-template-columns: 1fr; }
  .music-note-card { display: none; }
}
@media (max-width: 650px) {
  .topbar { grid-template-columns: 1fr auto; padding-inline: 16px; }
  .topbar-copy { display: none; }
  .site-link { font-size: 9px; padding: 0 10px; }
  main { width: calc(100% - 24px); padding-top: 34px; }
  .dashboard-head { display: grid; }
  .secondary-button { justify-self: start; }
  .dashboard-head p { font-size: 11px; }
  .admin-tabs { margin: 28px 0 34px; }
  .admin-tab { min-height: 56px; padding: 8px; }
  .tab-icon { width: 29px; height: 29px; }
  .section-heading { display: grid; gap: 10px; }
  .section-heading p { font-size: 10px; }
  .media-grid { grid-template-columns: 1fr; }
  .media-copy p { min-height: auto; }
  .upload-card { grid-template-columns: 1fr; }
  .upload-visual { min-height: 160px; }
  .upload-copy { padding: 22px 18px; }
  .upload-actions { grid-template-columns: 1fr; }
  .music-library { padding: 16px 12px; }
  .music-admin-row { grid-template-columns: auto 1fr auto; gap: 9px; }
  .music-admin-stat { grid-row: 2; }
  .music-admin-stat:nth-of-type(1) { grid-column: 2; }
  .music-admin-stat:nth-of-type(2) { grid-column: 3; }
  .music-ready { grid-column: 1 / -1; justify-self: end; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* Cập nhật Tool */
.tools-heading { margin-bottom: 24px; }
.tool-notice { margin-bottom: 20px; }
.tool-release-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tool-release-card { position: relative; overflow: hidden; min-height: 330px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(160deg, rgba(18,19,29,.97), rgba(11,12,18,.97)); box-shadow: 0 22px 60px rgba(0,0,0,.16); }
.tool-release-card::before { content: ""; position: absolute; width: 180px; height: 180px; right: -90px; top: -90px; border-radius: 50%; background: var(--tool-accent, #8d58ff); filter: blur(70px); opacity: .13; pointer-events: none; }
.tool-release-card[data-tool="fix"] { --tool-accent: #ff4f7d; }
.tool-release-card[data-tool="backup"] { --tool-accent: #55d7ff; }
.tool-release-card[data-tool="autosave"] { --tool-accent: #50ffa9; }
.tool-release-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tool-release-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--tool-accent) 38%, transparent); border-radius: 13px; background: color-mix(in srgb, var(--tool-accent) 10%, transparent); color: color-mix(in srgb, var(--tool-accent) 72%, white); font-size: 20px; font-weight: 900; }
.tool-release-state { padding: 6px 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 999px; color: #737684; font-size: 7px; font-weight: 900; letter-spacing: .12em; }
.tool-release-state.ready { border-color: rgba(73,214,147,.22); background: rgba(73,214,147,.06); color: #78e7b3; }
.tool-release-card h3 { position: relative; z-index: 1; margin: 20px 0 7px; font-size: 21px; letter-spacing: -.035em; }
.tool-release-card > p { position: relative; z-index: 1; min-height: 38px; margin: 0; color: #858896; font-size: 10px; }
.tool-current { position: relative; z-index: 1; display: grid; gap: 6px; margin-top: 18px; padding: 13px; border: 1px solid rgba(255,255,255,.07); border-radius: 13px; background: rgba(7,8,12,.42); }
.tool-current strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.tool-current span { color: #666977; font-size: 8px; line-height: 1.5; }
.tool-selected { position: relative; z-index: 1; min-height: 34px; margin: 15px 0 0; color: #8f92a0; font-size: 9px; line-height: 1.5; }
.tool-selected strong { color: #f0edf7; }
.tool-release-actions { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.tool-choose { border: 1px solid var(--line); background: transparent; color: #f3f1f7; }
.tool-upload { border: 0; background: linear-gradient(135deg, color-mix(in srgb, var(--tool-accent) 78%, #6e42d3), color-mix(in srgb, var(--tool-accent) 52%, #5a36ad)); color: #fff; }
.tool-upload:disabled { cursor: default; opacity: .36; transform: none; }
.tool-release-card.busy { opacity: .62; pointer-events: none; }
.tool-release-progress { position: relative; z-index: 1; margin-top: 13px; }
.tool-release-progress .upload-meter-track > span { background: linear-gradient(90deg, var(--tool-accent), #fff); box-shadow: 0 0 18px color-mix(in srgb, var(--tool-accent) 42%, transparent); }
.tool-open-link { position: relative; z-index: 1; display: inline-flex; margin-top: 13px; color: color-mix(in srgb, var(--tool-accent) 70%, white); font-size: 8px; font-weight: 800; text-decoration: none; }
.tool-open-link:hover { color: #fff; }

@media (max-width: 900px) {
  .admin-tabs { grid-template-columns: repeat(3, 1fr); }
  .tool-release-grid { grid-template-columns: 1fr; }
  .tool-release-card { min-height: auto; }
}
@media (max-width: 650px) {
  .admin-tabs { grid-template-columns: 1fr; }
  .admin-tab { min-height: 52px; }
  .tool-release-actions { grid-template-columns: 1fr; }
}
