:root {
  --bg: #0e1014;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #9aa1ad;
  --accent: #7aa2ff;
  --accent-2: #9d7bff;
  --danger: #ff6b6b;
  --ok: #56d68a;
  --radius: 10px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: 78px; /* room for player bar */
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 12px; }
img { display: block; }

/* ---- Top nav ---- */
.nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: #11141a; border-bottom: 1px solid var(--border);
}
.nav .brand { font-weight: 700; letter-spacing: .2px; color: var(--text); }
.nav .brand b { color: var(--accent); }
.nav a.link { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.nav a.link:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.link.active { color: var(--text); background: var(--panel-2); }
.nav .spacer { flex: 1; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 22px 40px; }

/* ---- Buttons / forms ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 13px; font-size: 14px; cursor: pointer; transition: .12s;
}
.btn:hover { border-color: #3a4150; background: #262b35; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1020; font-weight: 600; }
.btn.primary:hover { background: #93b4ff; }
.btn.danger { color: var(--danger); border-color: #43323a; }
.btn.danger:hover { background: #3a2530; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 6px 9px; }
input[type=text], input[type=password], input[type=search], select {
  background: #0f1218; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 14px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.right { margin-left: auto; }

/* ---- Flash / errors ---- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.flash.ok { background: #112a1d; border-color: #1f5239; color: var(--ok); }
.flash.err { background: #2c1518; border-color: #5a2a30; color: var(--danger); }

/* ---- Toolbar ---- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar form.search { flex: 1; max-width: 380px; }

/* ---- Album grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: .12s; }
.card:hover { border-color: #3a4150; transform: translateY(-2px); }
.card .art { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--panel-2); }
.card .art.placeholder { display: flex; align-items: center; justify-content: center; color: #3f4654; font-size: 34px; }
.card .meta { padding: 10px 12px; }
.card .meta .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Detail header ---- */
.detail-head { display: flex; gap: 20px; margin-bottom: 24px; align-items: flex-end; }
.detail-head .art { width: 180px; height: 180px; border-radius: var(--radius); object-fit: cover; background: var(--panel-2); border: 1px solid var(--border); }
.detail-head .art.placeholder { display: flex; align-items: center; justify-content: center; font-size: 60px; color: #3f4654; }
.detail-head .info .kind { color: var(--accent); text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
.detail-head .info h1 { margin: 6px 0 8px; font-size: 28px; }

/* ---- Track / file tables ---- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.list td { padding: 9px 10px; border-bottom: 1px solid #20242d; }
table.list tr:hover td { background: var(--panel); }
table.list .num { width: 38px; color: var(--muted); text-align: right; }
table.list .dur { color: var(--muted); text-align: right; white-space: nowrap; }
table.list .acts { text-align: right; white-space: nowrap; width: 1%; }
.playbtn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 6px; border-radius: 6px; }
.playbtn:hover { color: var(--accent); background: var(--panel-2); }

/* ---- Breadcrumb ---- */
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: #4a505c; }

/* ---- Dropzone ---- */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); transition: .12s; cursor: pointer; }
.dropzone.drag { border-color: var(--accent); background: #141a26; color: var(--text); }
.uploads { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.uprow { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.uprow .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; width: 160px; }
.bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s; }
.uprow .st.done { color: var(--ok); }
.uprow .st.err { color: var(--danger); }

/* ---- Modal / menu ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 360px; max-width: calc(100vw - 40px); }
.modal h3 { margin: 0 0 14px; }
.menu { position: absolute; right: 0; top: 110%; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px; min-width: 190px; z-index: 50; box-shadow: 0 8px 26px rgba(0,0,0,.4); }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--panel-2); text-decoration: none; }
.menu .div { height: 1px; background: var(--border); margin: 6px 4px; }
.rel { position: relative; }

/* ---- Song picker (add to playlist) ---- */
.picker { position: absolute; right: 0; top: 110%; width: 380px; max-width: calc(100vw - 40px); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px; z-index: 55; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.picker > input[type=search] { margin-bottom: 8px; }
.picker-results { max-height: 340px; overflow-y: auto; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #20242d; }
.picker-row .picker-meta { flex: 1; min-width: 0; }
.picker-row .picker-meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-row .picker-meta small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-row { cursor: pointer; }
.picker-all { display: flex; align-items: center; gap: 8px; padding: 6px 4px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); cursor: pointer; }
.picker-row input[type=checkbox], .picker-all input[type=checkbox] { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
.picker-added { color: var(--ok); font-size: 12px; flex: 0 0 auto; }
.picker-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.picker-foot .muted { margin-right: auto; }

/* ---- Player bar ---- */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  background: #11141a; border-top: 1px solid var(--border); padding: 10px 18px;
}
.player .pa { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
.player .pmeta { min-width: 170px; max-width: 260px; }
.player .pmeta .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .pmeta .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .pbtn { background: var(--accent); color: #0b1020; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.player audio { flex: 1; height: 38px; }
.player .empty { color: var(--muted); flex: 1; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 340px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.login .brand { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login .brand b { color: var(--accent); }
.login .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login .field { margin-bottom: 14px; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ---- Panels (profile) ---- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; max-width: 520px; }
.panel h2 { margin-top: 0; }
.field { margin-bottom: 14px; }
.field .err { color: var(--danger); font-size: 13px; margin-top: 5px; }
.field input[readonly] { color: var(--muted); font-family: ui-monospace, monospace; }
