:root {
  --jc-accent: #fde0ac;
  --jc-accent-text: #6b4a12;
  color-scheme: light dark;
  --surface-0: #ffffff;
  --surface-1: #f7f6f3;
  --surface-2: #ffffff;
  --text-primary: #1a1a18;
  --text-secondary: #5f5e5a;
  --text-muted: #888780;
  --border: #e4e2db;
  --border-strong: #cfccc2;
  --bg-success: #eaf3de;
  --text-success: #27500a;
  --bg-warning: #faeeda;
  --text-warning: #854f0b;
  --bg-danger: #f8e2e2;
  --text-danger: #9c2b2b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-0: #161614;
    --surface-1: #1f1f1c;
    --surface-2: #232320;
    --text-primary: #f1efe8;
    --text-secondary: #b4b2a9;
    --text-muted: #888780;
    --border: #33322c;
    --border-strong: #44443e;
    --bg-success: #173404;
    --text-success: #c0dd97;
    --bg-warning: #412402;
    --text-warning: #fac775;
    --bg-danger: #3a1414;
    --text-danger: #f2a3a3;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
}

.jc-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.jc-side {
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.jc-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text-primary);
}
.jc-logo span {
  font-family: "Averia Sans Libre", cursive;
  font-size: 19px;
}

.jc-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}
.jc-nav i { font-size: 17px; }
.jc-nav.active {
  color: var(--text-primary);
  font-weight: 500;
  background: var(--surface-0);
  border-right: 2px solid var(--jc-accent);
}
.jc-nav:hover:not(.active) { color: var(--text-primary); }

.jc-profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-primary);
}
.jc-profile.active { background: var(--surface-0); }
.jc-profile-info { flex: 1; display: flex; flex-direction: column; }
.jc-profile-name { font-size: 14px; font-weight: 500; }
.jc-profile-role { font-size: 12px; color: var(--text-muted); }
.jc-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--jc-accent); color: var(--jc-accent-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; flex-shrink: 0;
  object-fit: cover;
}

.jc-band-name {
  font-size: 12px; color: var(--text-muted); margin: 0; padding: 8px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.jc-main { padding: 28px 36px; max-width: 900px; }

.jc-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.jc-h { font-size: 20px; font-weight: 500; margin: 0 0 4px; }
.jc-sub { font-size: 13px; color: var(--text-muted); margin: 0; }
.jc-section-h { font-size: 14px; font-weight: 500; margin: 24px 0 10px; }

.jc-badge {
  font-size: 11px; padding: 2px 9px; border-radius: 6px; font-weight: 500;
}
.jc-badge-success { background: var(--bg-success); color: var(--text-success); }
.jc-badge-warning { background: var(--bg-warning); color: var(--text-warning); }
.jc-badge-neutral { background: var(--surface-1); color: var(--text-muted); }

.jc-list { border-top: 1px solid var(--border); }
.jc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
  font-size: 14px; color: inherit;
}
.jc-row-link { text-decoration: none; color: var(--text-primary); }
.jc-row-link:hover { background: var(--surface-1); }
/* Songs the current viewer hasn't subscribed to -- dimmed so at a glance
   they can tell what they actually have synced locally vs. what's just
   sitting on the server. Still fully interactive (checkbox, click-through,
   hover) -- this is a visual cue, not a disabled state. */
.jc-row-unsynced { opacity: 0.55; }
.jc-row-unsynced:hover { opacity: 0.85; }
.jc-grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-muted { color: var(--text-muted); }
.jc-mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.jc-col-sm { width: 80px; flex-shrink: 0; }
.jc-col-md { width: 150px; flex-shrink: 0; }
/* Revealing the full token makes this text much wider than its 150px
   column -- anchor it to the right so the overflow grows left into the
   row's slack space instead of spilling right, under the action buttons. */
.token-display { white-space: nowrap; }
/* Revealing the full token makes this text much wider than the masked
   column (150px). text-align can't push overflow left -- it only
   redistributes slack space, and an overflowing nowrap run always spills
   in normal (rightward) order regardless of alignment. So instead let the
   column grow to fit its content; the name/badge column next to it
   (.jc-grow, flex:1 + min-width:0) shrinks to make room, which is what
   visually reads as "the reveal pushes things left". */
.token-display.revealed { width: auto; flex-shrink: 1; }
.jc-empty { color: var(--text-muted); font-size: 14px; padding: 24px 4px; }

.jc-row-header { padding: 6px 4px; cursor: default; }
.jc-sort-btn {
  background: none; border: none; padding: 0; margin: 0; font: inherit;
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); cursor: pointer; text-align: left;
}
.jc-sort-btn:hover { color: var(--text-primary); }
.jc-sort-arrow { font-size: 9px; }

.jc-btn {
  font-size: 13px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: transparent;
  color: var(--text-secondary); display: inline-flex; align-items: center;
  gap: 6px; cursor: pointer; white-space: nowrap;
}
.jc-btn:hover { background: var(--surface-1); color: var(--text-primary); }
.jc-btn:active { transform: scale(0.98); }
.jc-btn:disabled { opacity: 0.4; cursor: default; }
.jc-btn:disabled:hover { background: transparent; }

.jc-btn-danger { border-color: var(--text-danger); color: var(--text-danger); }
.jc-btn-danger:hover { background: var(--bg-danger); color: var(--text-danger); }

.jc-select {
  font-size: 13px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-0);
  color: var(--text-secondary); width: 170px;
}

.jc-textarea {
  width: 100%; font-size: 13px; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  padding: 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary); resize: vertical;
}

.jc-row-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

.jc-input {
  font-size: 13px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-0);
  color: var(--text-primary);
}
.jc-row-active { background: var(--surface-1); }
.jc-dm-bubble { display: inline-block; max-width: 70%; padding: 8px 12px; border-radius: 10px; text-align: left; }
.jc-dm-mine { background: var(--bg-success); }
.jc-dm-theirs { background: var(--surface-1); }

.jc-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.jc-tab {
  background: none; border: none; padding: 0 0 10px; margin: 0;
  font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px;
}
.jc-tab:hover { color: var(--text-primary); }
.jc-tab.active { color: var(--text-primary); border-bottom-color: var(--text-primary); }

.jc-setup-body { margin: 0; }
.jc-setup-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.jc-setup-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  width: 440px; max-width: 100%; padding: 1.75rem;
}
.jc-setup-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.jc-setup-title { font-size: 17px; font-weight: 500; margin: 0; }
.jc-setup-label { font-size: 13px; font-weight: 500; display: block; margin: 0 0 6px; }
.jc-setup-input {
  width: 100%; font-size: 14px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-0); color: var(--text-primary);
}
.jc-setup-profile-row { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; }
.jc-setup-avatar-preview {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.jc-setup-avatar-placeholder {
  background: var(--jc-accent); color: var(--jc-accent-text);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 500;
}
.jc-setup-submit { width: 100%; justify-content: center; margin-top: 22px; }

.jc-tag-pill {
  display: inline-flex; align-items: center; font-size: 12px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
}
.jc-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; flex-shrink: 0;
}
.jc-track-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.jc-track-row:last-child { border-bottom: none; }
.jc-track-info {
  width: 190px; flex-shrink: 0; display: flex; flex-direction: column; gap: 3px; overflow: hidden;
}
.jc-track-title {
  font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jc-track-tag {
  font-size: 11px; color: var(--text-muted); display: flex; align-items: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jc-waveform-canvas {
  flex: 1 1 0%; width: 100%; height: 32px; min-width: 0; cursor: pointer;
  border-radius: 4px; background: var(--surface-1); display: block;
}
.jc-play-icon-btn {
  flex-shrink: 0; width: 32px; height: 32px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.jc-track-row.jc-mix-track-row {
  padding: 14px 12px; border: 1px solid var(--jc-accent); border-radius: 10px;
}
.jc-mix-track-row .jc-track-info { width: 220px; }
.jc-mix-track-row .jc-track-title { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.jc-mix-canvas { height: 56px; }
.jc-mix-track-row .jc-play-icon-btn { width: 40px; height: 40px; }

.jc-assign-tag { cursor: pointer; gap: 5px; }
.jc-assign-tag:hover { color: var(--text-primary); }

.jc-popover {
  position: absolute; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px; min-width: 190px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 50;
}
.jc-popover-list { max-height: 240px; overflow-y: auto; margin-bottom: 6px; }
.jc-popover-item { padding: 6px 10px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.jc-popover-item:hover { background: var(--surface-1); }
.jc-popover-new { display: flex; gap: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.jc-popover-new input {
  flex: 1; font-size: 13px; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface-0); color: var(--text-primary);
}

.jc-notes-wall { display: flex; flex-direction: column; gap: 14px; }
.jc-note-post { display: flex; gap: 10px; }
.jc-note-body { flex: 1; min-width: 0; }
.jc-note-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.jc-note-author { font-size: 13px; font-weight: 500; }
.jc-note-time { font-size: 12px; }
.jc-note-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

.jc-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.jc-modal {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; width: 600px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
}
.jc-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.jc-raw-notes {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 12px; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  white-space: pre-wrap; max-height: 200px; overflow-y: auto; margin: 0 0 1rem;
}
