:root {
  --bg: #0f1115;
  --bg2: #171a21;
  --card: #1d212b;
  --card2: #242936;
  --line: #2c3140;
  --text: #e8eaf0;
  --muted: #8b93a5;
  --acc: #6c8cff;
  --acc2: #4f6adf;
  --good: #3ecf8e;
  --warn: #f2b84b;
  --bad: #ff5d6c;
  --radius: 14px;
  --nav-h: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
button:focus, input:focus, select:focus, textarea:focus, a:focus { outline: none; }

html { height: 100%; overflow-y: scroll; overflow-x: hidden; }
body { min-height: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }
#screen { flex: 1 1 auto; padding: 0 14px 90px; }
#topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 4px 6px; display: none; }
#topbar.visible { display: flex; align-items: center; gap: 10px; }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h);
  background: rgba(20, 23, 30, 0.96); border-top: 1px solid var(--line);
  display: flex; align-items: stretch; z-index: 30;
}
#nav button {
  flex: 1; background: none; border: none; color: var(--muted); font-size: 10.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 4px 2px; cursor: pointer;
}
#nav button.active { color: var(--acc); }
#nav button svg { width: 22px; height: 22px; }
#nav .nav-badge {
  position: absolute; top: 5px; right: 14px; min-width: 15px; height: 15px;
  background: var(--bad); color: #fff; font-size: 9px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
#nav .item { position: relative; }
.vmeta { font-size: 9px; color: var(--muted); padding: 6px 2px; word-break: break-all; max-width: 100%; flex: 0 0 auto; }

/* ---------- generic ---------- */
h1.title { font-size: 20px; margin: 14px 2px 10px; }
h2 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; }
.grow { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }

button.btn {
  border: none; border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 600;
  background: var(--acc); color: #fff; cursor: pointer;
}
button.btn:active { opacity: 0.85; }
button.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
button.btn.danger { background: var(--bad); }
button.btn.good { background: var(--good); color: #0a1a12; }
button.btn.warn { background: var(--warn); color: #2a2000; }
button.btn.small { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
button.btn:disabled { opacity: 0.5; }

input, select, textarea {
  width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); }
textarea { resize: vertical; min-height: 64px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 5px; }
label.btn { display:inline-flex; align-items:center; gap:6px; cursor:pointer; margin:0; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge.blue { background: rgba(108,140,255,0.16); color: var(--acc); }
.badge.green { background: rgba(62,207,142,0.16); color: var(--good); }
.badge.yellow { background: rgba(242,184,75,0.16); color: var(--warn); }
.badge.red { background: rgba(255,93,108,0.16); color: var(--bad); }
.badge.gray { background: var(--card2); color: var(--muted); }

.chip { display: inline-block; margin: 2px 4px 2px 0; }

.avatar-img {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--card2);
}
.avatar-ph { width: 52px; height: 52px; border-radius: 50%; background: var(--acc2); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:20px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.toast-wrap {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100;
  max-width: 92vw; display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.toast { background: #242a37; color: var(--text); border: 1px solid var(--line); padding: 9px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.toast.err { border-color: var(--bad); }
.toast.ok { border-color: var(--good); }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }

/* ---------- home ---------- */
.profile-line { display: flex; gap: 12px; align-items: center; }
.profile-line .avatar-ph, .profile-line .avatar-img { width: 48px; height: 48px; }
.stats { display: flex; gap: 8px; margin: 10px 0; }
.stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 19px; }
.stat span { font-size: 11px; color: var(--muted); }
.sect-link { display:flex; align-items:center; gap: 12px; padding: 12px; background: var(--card); border:1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; }
.sect-link:hover { border-color: var(--acc); }
.sect-link .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--card2); display:flex; align-items:center; justify-content:center; color: var(--acc); }
.sect-link .ic svg { width: 20px; height: 20px; }
.sect-link b { font-size: 14.5px; }
.sect-link p { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- artists ---------- */
.artist-scroll { display: flex; gap: 12px; }
.artist-list { flex: 0 0 250px; max-height: calc(100vh - 170px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.artist-item { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.artist-item.active { border-color: var(--acc); background: var(--card2); }
.artist-item .avatar-img, .artist-item .avatar-ph { width: 40px; height: 40px; font-size: 16px; }
.artist-item b { font-size: 14px; }
.artist-item .mini { font-size: 11px; color: var(--muted); }
.artist-pane { flex: 1; min-width: 0; }
.back { display:none; }

@media (max-width: 700px) {
  .artist-scroll { display: block; }
  .artist-list.is-open { display: flex; }
  .artist-list { max-height: none; flex: none; width: 100%; display: none; }
  .artist-pane { display: none; }
  .artist-pane.is-open { display: block; }
  .back { display: inline-flex; align-items: center; gap: 6px; background:none; border:1px solid var(--line); color:var(--text); border-radius:9px; padding:7px 12px; margin-bottom:10px; cursor:pointer; }
}

.release { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.release:last-child { border-bottom: none; }
.release .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: 0 0 auto; }
.work-item { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.work-item:last-child { border-bottom:none; }
.work-item .who { color: var(--acc); font-weight: 600; }

/* ---------- tasks ---------- */
.tabbar { display:flex; gap:6px; margin: 12px 0 10px; flex-wrap: wrap; }
.tabbar button.glob { border:1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 20px; font-size: 13px; cursor: pointer; }
.tabbar button.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.task-item { padding: 12px; background: var(--card); border:1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.task-item .t { font-size: 14.5px; font-weight: 600; }
.task-item .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.task-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.task-actions button { margin: 0; }
.user-pill { display:inline-flex; align-items:center; background:var(--card2); border:1px solid var(--line); border-radius:10px; padding:5px 10px; margin:4px 6px 4px 0; font-size:13px; gap:6px; }

.form-row { margin-bottom: 4px; }
.check { display:flex; align-items:center; gap:8px; margin-top:10px; font-size:14px; }
.check input { width:auto; }

/* ---------- admin ---------- */
.admin-user { display:flex; align-items:center; gap:10px; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:10px 12px; margin-bottom:8px; flex-wrap:wrap; }
.admin-user .who { flex:1; min-width:150px; }

/* ---------- docs ---------- */
.doc-card { display:flex; align-items:center; gap:12px; padding:14px; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); margin-bottom:10px; }
.doc-card .ic { width:38px; height:38px; background:var(--card2); border-radius:10px; display:flex; align-items:center; justify-content:center; color:var(--good); }
.doc-card .ic svg { width:20px; height:20px; }

#toast { display: contents; }
/* ---------- desktop: sidebar panel (body.desk) ---------- */
body.desk { --side-w: 240px; }
body.desk.narrow { --side-w: 190px; }
body.desk #app { flex-direction: row; }
body.desk #screen { margin-left: var(--side-w); padding: 0 26px 40px; }
body.desk #topbar { position: fixed; left: var(--side-w); top: 0; right: 0; z-index: 20; background: var(--bg); }

body.desk #nav {
  position: fixed; left: 0; top: 0; bottom: 0; height: 100vh;
  width: var(--side-w);
  background: rgba(15, 17, 21, 0.98); border-right: 1px solid var(--line); border-top: none;
  flex-direction: column; justify-content: flex-start; align-items: stretch;
  padding: 14px 10px; gap: 4px; overflow-y: auto; scrollbar-gutter: stable; display: flex;
}
body.desk #nav button {
  flex: 0 0 auto; width: 100%; flex-direction: row; justify-content: flex-start;
  gap: 10px; font-size: 13.5px; padding: 11px 12px; border-radius: 10px; text-align: left;
  display: flex; align-items: center;
}
body.desk #nav button:hover { background: var(--card); }
body.desk #nav button.active { background: rgba(108, 140, 255, 0.14); }
body.desk #nav button svg { width: 20px; height: 20px; flex: 0 0 auto; }
body.desk #nav .item { position: relative; display: flex; align-items: center; }
body.desk #nav .nav-badge { position: static; margin-left: 8px; }
body.desk h1.title { margin: 22px 2px 16px; font-size: 22px; }

body.desk.narrow #nav { padding: 12px 8px; }
body.desk.narrow #nav button { padding: 9px 10px; font-size: 12.5px; gap: 8px; }
body.desk.narrow #screen { padding: 0 16px 32px; }
