/* ===========================
   CSS Custom Properties
   =========================== */
:root {
  --bg-base:     #0d1117;
  --bg-surface:  #161b22;
  --bg-elevated: #21262d;
  --bg-input:    #0d1117;
  --bg-hover:    rgba(255,255,255,0.05);
  --bg-overlay:  rgba(0,0,0,0.65);

  --border:      #30363d;
  --border-focus:#7c3aed;

  --text:        #e6edf3;
  --text-sub:    #8b949e;
  --text-muted:  #484f58;

  --accent:      #7c3aed;
  --accent-h:    #6d28d9;
  --accent-dim:  rgba(124,58,237,0.18);

  --danger:      #f85149;
  --danger-h:    #da3633;

  --s-offen:     #6b7280;
  --s-offen-bg:  rgba(107,114,128,0.15);
  --s-pass1:     #f59e0b;
  --s-pass1-bg:  rgba(245,158,11,0.15);
  --s-pass2:     #38bdf8;
  --s-pass2-bg:  rgba(56,189,248,0.15);
  --s-erledigt:  #4ade80;
  --s-erledigt-bg: rgba(74,222,128,0.15);

  --radius-s: 4px;
  --radius:   8px;
  --radius-l: 12px;

  --shadow:   0 4px 16px rgba(0,0,0,0.4);
  --shadow-s: 0 1px 4px rgba(0,0,0,0.3);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', 'Liberation Mono', monospace;
  --transition: 120ms ease;
}

[data-theme="light"] {
  --bg-base:     #ffffff;
  --bg-surface:  #f6f8fa;
  --bg-elevated: #eaeef2;
  --bg-input:    #ffffff;
  --bg-hover:    rgba(0,0,0,0.04);
  --bg-overlay:  rgba(0,0,0,0.45);

  --border:      #d0d7de;

  --text:        #1f2328;
  --text-sub:    #57606a;
  --text-muted:  #8c959f;

  --shadow:   0 4px 16px rgba(0,0,0,0.12);
  --shadow-s: 0 1px 4px rgba(0,0,0,0.08);
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

/* ===========================
   Login
   =========================== */
#loginView {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-base);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-sub);
}

/* ===========================
   Forms
   =========================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
}

.form-group textarea { resize: vertical; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-grid .span-2 { grid-column: span 2; }

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  padding: 6px 0;
}

.req { color: var(--danger); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
}

.checkbox-label input[type="checkbox"] { width: auto; }

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-s);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-sub); }

.btn-full { width: 100%; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text-sub);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  transition: all var(--transition);
}
.btn-icon:hover { color: var(--text); border-color: var(--text-sub); }

.btn-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 3px 6px;
  border-radius: var(--radius-s);
  transition: all var(--transition);
  line-height: 1;
}
.btn-delete:hover { color: var(--danger); background: rgba(248,81,73,0.12); }

.btn-edit {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 3px 6px;
  border-radius: var(--radius-s);
  transition: all var(--transition);
  line-height: 1;
}
.btn-edit:hover { color: var(--accent); background: var(--accent-dim); }

.td-row-actions { white-space: nowrap; }

/* ===========================
   App Layout
   =========================== */
#appView {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.brand-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.brand-sub {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 500;
}

.header-center { flex: 1; display: flex; justify-content: center; }

.online-badge {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.online-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--s-erledigt);
}

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

.user-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
}

/* ===========================
   Navigation
   =========================== */
.app-nav {
  display: flex;
  gap: 0;
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 52px;
  z-index: 40;
}

.nav-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-sub);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 14px;
  transition: all var(--transition);
}

.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===========================
   Main Content
   =========================== */
.app-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-title { font-size: 15px; font-weight: 600; }
.toolbar-spacer { flex: 1; }

.song-count {
  font-size: 12px;
  color: var(--text-muted);
}

.search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  width: 200px;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--border-focus); }

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.section-card {
  margin: 20px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.section-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-sub);
}

/* ===========================
   Songs Table
   =========================== */
.songs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 1700px;
}

.songs-table thead tr {
  background: var(--bg-surface);
}

.songs-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.songs-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.songs-table td[data-field="name"] { font-weight: 700; text-transform: uppercase; }

.songs-table tbody tr:hover td { background: var(--bg-hover); }
.songs-table tbody tr.sortable-ghost td { background: var(--accent-dim); opacity: 0.6; }
.songs-table tbody tr.sortable-chosen td { background: var(--accent-dim); }

/* Column widths */
.th-drag   { width: 32px; }
.th-pos    { width: 80px; }
.th-nr     { width: 64px; }
.th-name   { min-width: 160px; }
.th-bpm    { width: 55px; }
.th-seq    { width: 75px; }
.th-tcbool { width: 38px; text-align: center; }
.th-tc     { width: 110px; }
.th-loop   { width: 110px; }
.songs-table td[data-field="timecode_start"] { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; }
.songs-table .td-loop { padding: 2px 6px; }
.songs-table .loop-time { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; line-height: 1.6; padding: 1px 2px; border-radius: 2px; }
.songs-table .loop-time.editable:hover { background: var(--hover); cursor: text; }
.th-page   { width: 65px; }
.th-arr    { min-width: 110px; }
.th-status { width: 120px; }
.th-color  { width: 95px; }
.th-text   { min-width: 120px; max-width: 180px; }
.th-actions { width: 56px; }

/* TC checkbox cell */
.td-tc-bool { text-align: center; }
.tc-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  display: block;
  text-align: center;
  user-select: none;
  transition: color var(--transition);
}
.drag-handle:hover { color: var(--text-sub); }
.drag-handle:active { cursor: grabbing; }

/* Editable cells */
.editable {
  cursor: text;
  position: relative;
}

.editable:hover::after {
  content: '';
  position: absolute;
  inset: 2px 1px;
  border: 1px dashed var(--border-focus);
  border-radius: var(--radius-s);
  pointer-events: none;
  opacity: 0.5;
}

.inline-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-s);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 2px 6px;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Status filter in header */
.status-filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text-sub);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 20px 3px 6px;
  cursor: pointer;
  outline: none;
  width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  transition: border-color var(--transition), color var(--transition);
}
.status-filter-select:hover { border-color: var(--border-focus); }
.status-filter-select:focus { border-color: var(--border-focus); color: var(--text); }
.status-filter-select.is-active { border-color: var(--accent); color: var(--text); }

/* Status select */
.status-select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px 3px 8px;
  border: none;
  cursor: pointer;
  outline: none;
  font-family: var(--font);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  padding-right: 18px;
  transition: opacity var(--transition);
}
.status-select:hover { opacity: 0.85; }

.status-offen    { background: var(--s-offen-bg);    color: var(--s-offen); }
.status-pass1    { background: var(--s-pass1-bg);    color: var(--s-pass1); }
.status-pass2    { background: var(--s-pass2-bg);    color: var(--s-pass2); }
.status-erledigt { background: var(--s-erledigt-bg); color: var(--s-erledigt); }

/* Readonly mode */
.readonly-mode #addSongBtn,
.readonly-mode #addDividerBtn { display: none; }

/* Status badge (readonly view) */
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-sub);
  border-left: 3px solid transparent;
  white-space: nowrap;
}

/* Color cell readonly */
.color-cell-ro {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Text readonly */
.text-ro {
  font-size: 12px;
  color: var(--text-sub);
}
.text-ro.has-content { color: var(--text); }

/* Role badges in users table */
.role-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.role-admin    { background: rgba(124,58,237,0.2); color: #a78bfa; }
.role-standard { background: var(--bg-elevated); color: var(--text-sub); }
.role-readonly { background: rgba(56,189,248,0.15); color: #38bdf8; }

/* Row colors injected dynamically via JS (injectStatusStyles) */
#songsBody tr[data-status]:hover td { background: transparent; }

/* Color cells */
.color-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.color-swatch:hover { transform: scale(1.15); }

.color-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
}

/* Text preview cells */
.text-btn {
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-sub);
  font-family: var(--font);
  font-size: 13px;
  padding: 2px 0;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  display: block;
  border-radius: var(--radius-s);
  transition: color var(--transition);
}
.text-btn:hover { color: var(--text); }
.text-btn.has-content { color: var(--text); }

/* Divider rows */
.divider-row td {
  background: var(--bg-elevated);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  padding: 10px 10px;
}
.divider-row:hover td { background: var(--bg-hover); }

.divider-label-cell {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-sub);
  cursor: text;
}

/* Inline add row */
.inline-add-row td { padding: 0; background: var(--bg-elevated); }

.inline-add-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-top: 2px dashed var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 12px 16px;
  outline: none;
  transition: background var(--transition), border-color var(--transition);
}
.inline-add-input::placeholder { color: var(--text-sub); opacity: 1; }
.inline-add-input:focus {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ===========================
   Audit / Data Table
   =========================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.data-table thead tr {
  background: var(--bg-surface);
}

.data-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.data-table tbody tr:hover td { background: var(--bg-hover); }

.audit-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
}

.audit-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  padding: 2px 8px;
}

.action-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
.action-erstellt  { background: rgba(74,222,128,0.15); color: #4ade80; }
.action-geändert  { background: rgba(56,189,248,0.15); color: #38bdf8; }
.action-gelöscht  { background: rgba(248,81,73,0.15);  color: #f85149; }
.action-sortiert  { background: rgba(245,158,11,0.15); color: #f59e0b; }

/* ===========================
   Modals
   =========================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(2px);
}

.modal-box {
  position: relative;
  z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  width: 600px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
  animation: modal-in 0.15s ease;
}

.modal-sm { width: 380px; }

@keyframes modal-in {
  from { transform: scale(0.96) translateY(-8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-s);
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--bg-hover); }

.modal-body { padding: 20px; }
.modal-body textarea { resize: vertical; min-height: 120px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Color input inside modal */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 4px 8px;
}

.color-input-wrap input[type="color"] {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 0;
  cursor: pointer;
  background: none;
}

.color-hex-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
}

/* ===========================
   Toasts
   =========================== */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: var(--shadow);
}

.toast.show { opacity: 1; transform: none; }
.toast-success { background: #166534; border: 1px solid #4ade80; color: #4ade80; }
.toast-error   { background: #7f1d1d; border: 1px solid #f87171; color: #fca5a5; }
.toast-info    { background: var(--accent); border: 1px solid rgba(255,255,255,0.2); }

/* ===========================
   Color Popover
   =========================== */
.color-popover {
  position: fixed;
  z-index: 800;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  width: 300px;
}
.cp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 10px;
}
.cp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  border-radius: 5px;
  padding: 4px 2px;
  transition: background var(--transition);
}
.cp-item:hover { background: var(--bg-hover); }
.cp-swatch {
  width: 32px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(128,128,128,.3);
  flex-shrink: 0;
}
.cp-name {
  font-size: 9px;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}
.cp-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.cp-footer input[type="color"] {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  padding: 1px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}
.cp-footer label {
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
}

/* ===========================
   Working spinner
   =========================== */
@keyframes work-spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   Utilities
   =========================== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
