.library-layout {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr) 300px;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.library-side, .library-main, .library-queue {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #111218, #0b0c10);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h3 { font-size: 10px; letter-spacing: 0.16em; color: var(--text-dim); font-weight: 800; }
.panel-scroll { overflow: auto; padding: 10px 12px; flex: 1; min-height: 0; }

.source-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 9px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: left;
  border: 1px solid transparent;
  transition: all 0.12s;
}

.source-item:hover { background: #151820; color: var(--text); }
.source-item.is-active { background: rgba(255, 43, 43, 0.09); border-color: rgba(255, 43, 43, 0.3); color: #fff; }

.source-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: #191c24;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 26px;
}

.source-item.is-active .source-icon { background: var(--red); color: #fff; }
.source-sub { font-size: 9px; color: var(--text-muted); letter-spacing: 0.02em; }
.source-body { min-width: 0; display: grid; gap: 1px; }
.source-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-state { margin-left: auto; font-size: 8px; letter-spacing: 0.08em; color: var(--text-muted); }

.side-divider { height: 1px; background: var(--line-soft); margin: 12px 0; }
.side-title { font-size: 9px; letter-spacing: 0.16em; color: var(--text-muted); font-weight: 800; margin-bottom: 7px; padding: 0 4px; }

.playlist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: left;
}

.playlist-item:hover { background: #161922; color: #fff; }
.playlist-item .pl-count { margin-left: auto; font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); }
.playlist-item .pl-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--red); opacity: 0.7; }

/* search */
.search-bar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
.search-input-wrap { position: relative; flex: 1; }
.search-input-wrap .text-input { padding-left: 36px; height: 42px; font-size: 13px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none; }
.search-hint { padding: 8px 12px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--line-soft); line-height: 1.5; }
.search-hint b { color: var(--text-dim); }
.search-hint.is-warn { color: var(--warn); background: rgba(255, 176, 46, 0.05); }

.library-body { flex: 1; min-height: 0; overflow: auto; }

.track-table { width: 100%; border-collapse: collapse; }
.track-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #0d0e13;
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 800;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.track-row { border-bottom: 1px solid var(--line-soft); cursor: default; transition: background 0.1s; }
.track-row:hover { background: #14161d; }
.track-row.is-playing { background: rgba(255, 43, 43, 0.07); }
.track-row td { padding: 7px 12px; vertical-align: middle; font-size: 12px; }

.track-cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.track-thumb {
  width: 34px; height: 34px; border-radius: 5px; flex: 0 0 34px;
  background: #191c24; border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 9px; font-weight: 800; color: var(--text-muted);
  overflow: hidden;
}
.track-thumb img { width: 100%; height: 100%; object-fit: cover; }
.track-info { min-width: 0; display: grid; gap: 1px; }
.track-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.track-provider-tag { font-size: 8px; letter-spacing: 0.08em; font-weight: 800; padding: 2px 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--text-muted); }
.track-provider-tag.is-youtube { color: #ff5a5a; border-color: rgba(255, 90, 90, 0.35); }
.track-provider-tag.is-soundcloud { color: #ff9447; border-color: rgba(255, 148, 71, 0.3); }
.track-provider-tag.is-local { color: var(--text-dim); }

.track-duration { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.track-actions { display: flex; gap: 4px; justify-content: flex-end; }

.icon-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 5px;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.12s;
}
.icon-btn:hover { color: #fff; background: #1c2029; border-color: var(--line); }
.icon-btn.is-active { color: var(--red); border-color: rgba(255, 43, 43, 0.3); background: var(--red-soft); }
.icon-btn:disabled { opacity: 0.3; }

.mixable-note { font-size: 9px; color: var(--text-muted); }
.mixable-note.is-limited { color: var(--warn); }

/* right queue panel */
.queue-panel-list { display: grid; gap: 4px; padding: 10px; overflow: auto; }
.q-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 11px;
}
.q-row:hover { background: #151820; border-color: var(--line); }
.q-row .q-index { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); width: 16px; }
.q-row .q-body { min-width: 0; flex: 1; display: grid; gap: 1px; }
.q-row .q-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.q-row .q-sub { font-size: 9px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-row.is-current { background: rgba(255, 43, 43, 0.08); border-color: rgba(255, 43, 43, 0.25); }

.queue-panel-foot { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line-soft); }

/* add row */
.local-drop {
  margin: 0 12px 12px;
  border: 1px dashed #2c313d;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 9px;
  font-size: 11px;
  color: var(--text-muted);
  transition: all 0.15s;
  line-height: 1.45;
}
.local-drop .btn { width: 100%; }
.local-drop.is-over { border-color: var(--red); background: var(--red-soft); color: var(--text); }
.local-drop b { color: var(--text-dim); }
