/* =============================================
   BeatLab v2 — Brutalist Minimal
   Font: Unbounded (display) + DM Mono (data)
   ============================================= */

:root {
  --bg:       #0c0c0c;
  --bg1:      #111111;
  --bg2:      #181818;
  --line:     #222222;
  --line2:    #2e2e2e;
  --text:     #e8e8e8;
  --text2:    #666666;
  --text3:    #333333;
  --acc:      #d4ff47;       /* sharp lime */
  --acc-dim:  rgba(212,255,71,.08);
  --danger:   #ff3e3e;
  --warn:     #ff9500;
  --ok:       #39d98a;
  --sb:       180px;
  --pb:       52px;          /* player bar height */
  --f-head:   'Unbounded', sans-serif;
  --f-mono:   'DM Mono', monospace;
  --ease:     cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:    #f5f5f0;
  --bg1:   #eeeeea;
  --bg2:   #e5e5e0;
  --line:  #d8d8d0;
  --line2: #c8c8c0;
  --text:  #111111;
  --text2: #888888;
  --text3: #cccccc;
  --acc-dim: rgba(100,130,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--f-mono);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sb);
  background: var(--bg1);
  border-right: 1px solid var(--line);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .22s var(--ease);
}

.sidebar-top {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--f-head);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -1px;
  color: var(--acc);
}

.nav-close {
  display: none;
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.nav-list {
  list-style: none;
  flex: 1;
  padding: 16px 0;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text2);
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .03em;
  text-align: left;
  cursor: pointer;
  transition: color .15s, background .15s;
  border-left: 2px solid transparent;
}

.nav-btn:hover { color: var(--text); background: var(--bg2); }
.nav-btn.active {
  color: var(--acc);
  border-left-color: var(--acc);
  background: var(--acc-dim);
}

.nav-count {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--f-mono);
}

.nav-btn.active .nav-count { color: var(--acc); opacity: .6; }

.sidebar-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-btn {
  background: none;
  border: 1px solid var(--line2);
  color: var(--text2);
  font-family: var(--f-mono);
  font-size: 11px;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.theme-btn:hover { border-color: var(--text2); color: var(--text); }

.version { font-size: 10px; color: var(--text3); }

/* ── MAIN ── */
.main {
  margin-left: var(--sb);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--pb) + 24px);
}

/* topbar (mobile only) */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}
.hamburger {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
}
.topbar-title {
  font-family: var(--f-head);
  font-size: 13px;
  font-weight: 700;
}

/* ── PAGE ── */
.page { display: none; padding: 32px 36px; }
.page.active { display: block; animation: pageIn .2s var(--ease); }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* page header */
.ph {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

.pt {
  font-family: var(--f-head);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -1px;
  color: var(--text);
}

.pclock {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text2);
}

.ph-actions { display: flex; gap: 8px; align-items: center; }

/* ── STATS ROW ── */
.stats-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  margin-bottom: 28px;
  overflow-x: auto;
}

.stat {
  flex: 1;
  min-width: 90px;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  cursor: default;
  transition: background .15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat:last-child { border-right: none; }
.stat[data-nav] { cursor: pointer; }
.stat[data-nav]:hover { background: var(--bg2); }

.sn {
  font-family: var(--f-head);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--text);
}
.sl {
  font-size: 9px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* ── DASH GRID ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.dash-panel {
  background: var(--bg);
  padding: 20px 20px 16px;
}

.panel-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text2);
}

.link {
  background: none;
  border: none;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text2);
  cursor: pointer;
  transition: color .15s;
}
.link:hover { color: var(--acc); }

/* row list (recent items) */
.row-list { display: flex; flex-direction: column; }

.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s;
  font-size: 12px;
}
.row-item:last-child { border-bottom: none; }
.row-item:hover { color: var(--acc); }

.row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { color: var(--text2); font-size: 10px; flex-shrink: 0; }

/* status bars */
.status-bars { display: flex; flex-direction: column; gap: 10px; }

.sb-item { display: flex; align-items: center; gap: 10px; font-size: 10px; }
.sb-label { width: 72px; color: var(--text2); flex-shrink: 0; text-transform: uppercase; letter-spacing: .06em; }
.sb-track { flex: 1; height: 2px; background: var(--line2); position: relative; }
.sb-fill  { height: 100%; position: absolute; top: 0; left: 0; transition: width .5s var(--ease); }
.sb-n     { width: 20px; text-align: right; color: var(--text2); }

/* ── PROJECTS STRIP ── */
.projects-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.projects-strip::-webkit-scrollbar { display: none; }

.proj-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line2);
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  background: var(--bg1);
}
.proj-chip:hover { border-color: var(--text2); color: var(--text); }
.proj-chip.active { border-color: var(--acc); color: var(--acc); background: var(--acc-dim); }

.proj-chip-type {
  font-size: 9px;
  opacity: .6;
  text-transform: uppercase;
}

.proj-chip-del {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  margin-left: 4px;
  transition: color .12s;
}
.proj-chip-del:hover { color: var(--danger); }

.proj-chip-count {
  font-size: 9px;
  background: var(--bg2);
  padding: 1px 5px;
  color: var(--text2);
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.search-wrap { flex: 1; min-width: 160px; }

.search {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line2);
  padding: 6px 0;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.search::placeholder { color: var(--text3); }
.search:focus { border-bottom-color: var(--acc); }

.sel {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line2);
  padding: 6px 20px 6px 0;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23444'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  transition: border-color .15s, color .15s;
}
.sel:focus { border-bottom-color: var(--acc); color: var(--text); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tbl thead {
  border-bottom: 1px solid var(--line2);
}

.tbl th {
  text-align: left;
  padding: 10px 12px 10px 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text2);
  font-weight: 400;
  white-space: nowrap;
}
.tbl th:last-child { text-align: right; }

.tbl td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.tbl td:last-child { text-align: right; white-space: nowrap; }

.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--bg2); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* cell helpers */
.cell-name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-dim  { color: var(--text2); font-size: 11px; }
.cell-tag  {
  display: inline-block;
  font-size: 9px;
  padding: 1px 6px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid var(--line2);
  color: var(--text2);
}

/* status dots */
.dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  white-space: nowrap;
}
.dot::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-idea::before       { background: var(--text3); }
.dot-inprogress::before { background: var(--warn); }
.dot-mixing::before     { background: #7b7fff; }
.dot-finished::before   { background: var(--acc); }
.dot-demo::before       { background: var(--text3); }
.dot-final::before      { background: var(--warn); }
.dot-released::before   { background: var(--ok); }
.dot-new::before        { background: var(--text3); }
.dot-used::before       { background: var(--ok); }
.dot-fav::before        { background: #ff6b8a; }

/* row actions */
.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; opacity: 0; transition: opacity .15s; }
.tbl tbody tr:hover .row-actions { opacity: 1; }

.ra-btn {
  background: none;
  border: none;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  padding: 3px 6px;
  transition: color .12s;
}
.ra-btn:hover       { color: var(--text); }
.ra-btn.del:hover   { color: var(--danger); }
.ra-btn.fav-on      { color: #ff6b8a; }
.ra-btn.play-btn    { font-size: 13px; }

/* ── PLAY BUTTON in table ── */
.tbl-play {
  background: none;
  border: 1px solid var(--line2);
  color: var(--text2);
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--f-mono);
  transition: all .15s;
}
.tbl-play:hover { border-color: var(--acc); color: var(--acc); }
.tbl-play.playing { border-color: var(--acc); color: var(--acc); background: var(--acc-dim); }

/* no audio */
.na { color: var(--text3); font-size: 10px; }

/* empty */
.empty-row td {
  padding: 48px 0;
  text-align: center;
  color: var(--text3);
  font-size: 11px;
}

/* ── MODALS ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }

.modal {
  background: var(--bg1);
  border: 1px solid var(--line2);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: modIn .18s var(--ease);
}
.modal-sm { max-width: 380px; }
.modal-xs { max-width: 320px; }

@keyframes modIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-hd {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--f-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.5px;
  position: sticky;
  top: 0;
  background: var(--bg1);
  z-index: 1;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  transition: color .12s;
}
.close-btn:hover { color: var(--text); }

.modal-bd {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-ft {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg1);
}

/* forms */
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text2); }
.fg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.fi {
  background: var(--bg);
  border: 1px solid var(--line2);
  padding: 8px 10px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.fi::placeholder { color: var(--text3); }
.fi:focus { border-color: var(--acc); }

.fi-ta { resize: vertical; min-height: 72px; }

.hint { color: var(--text3); font-size: 10px; text-transform: none; letter-spacing: 0; }

/* check list (sample linking) */
.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition: all .12s;
}
.check-item:hover { border-color: var(--line2); }
.check-item.on { border-color: var(--acc); color: var(--acc); background: var(--acc-dim); }

.check-box {
  width: 12px; height: 12px;
  border: 1px solid var(--line2);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  transition: all .12s;
}
.check-item.on .check-box { background: var(--acc); border-color: var(--acc); color: var(--bg); }

/* drop zone */
.drop-zone {
  border: 1px dashed var(--line2);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--text2);
  transition: all .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--acc); color: var(--acc); }
.drop-label { color: var(--acc); cursor: pointer; text-decoration: underline; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--acc);
  margin-top: 6px;
  font-size: 11px;
  color: var(--acc);
}
.file-chip span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-rm { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 12px; }
.chip-rm:hover { color: var(--danger); }

/* ── BUTTONS ── */
.btn-solid {
  background: var(--acc);
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.btn-solid:hover { opacity: .85; transform: translateY(-1px); }

.btn-outline {
  background: none;
  color: var(--text2);
  border: 1px solid var(--line2);
  padding: 7px 16px;
  font-family: var(--f-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
}
.btn-outline:hover { border-color: var(--text2); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 16px;
  font-family: var(--f-mono);
  font-size: 11px;
  cursor: pointer;
}

.confirm-msg { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* ── PLAYER BAR ── */
.player-bar {
  position: fixed;
  bottom: 0; left: var(--sb); right: 0;
  height: var(--pb);
  background: var(--bg1);
  border-top: 1px solid var(--line2);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 300;
}

.player-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; width: 160px; flex-shrink: 0; }
.player-name { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.player-sub  { font-size: 10px; color: var(--text2); }

.player-controls { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.p-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  transition: color .12s;
  flex-shrink: 0;
}
.p-btn:hover { color: var(--acc); }
.p-close { font-size: 12px; }

.p-seek {
  flex: 1;
  height: 2px;
  appearance: none;
  background: var(--line2);
  outline: none;
  cursor: pointer;
  accent-color: var(--acc);
}

.p-time { font-size: 10px; color: var(--text2); flex-shrink: 0; width: 32px; text-align: right; }

/* ── TOAST ── */
.toast-rack {
  position: fixed;
  bottom: calc(var(--pb) + 12px);
  right: 16px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--line2);
  padding: 9px 14px;
  font-size: 11px;
  color: var(--text);
  border-left: 2px solid var(--acc);
  animation: tIn .2s var(--ease);
  pointer-events: auto;
}
.toast.err { border-left-color: var(--danger); }
.toast.info { border-left-color: #7b7fff; }
.toast.out { animation: tOut .2s var(--ease) forwards; }

@keyframes tIn  { from { opacity:0; transform:translateX(12px); } to { opacity:1; transform:none; } }
@keyframes tOut { from { opacity:1; } to { opacity:0; transform:translateX(12px); } }

/* ── SIDEBAR OVERLAY (mobile) ── */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 199;
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .nav-close { display: block; }
  .sb-overlay.open { display: block; }
  .topbar { display: flex; }
  .main { margin-left: 0; }
  .page { padding: 20px 18px; }
  .stats-row { flex-wrap: wrap; }
  .stat { min-width: 80px; }
  .dash-grid { grid-template-columns: 1fr; }
  .player-bar { left: 0; }
}

@media (max-width: 560px) {
  .fg-row { grid-template-columns: 1fr; }
  .ph-actions { flex-direction: column; gap: 6px; width: 100%; }
  .btn-solid, .btn-outline { width: 100%; text-align: center; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { width: 100%; }
}

/* scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); }

