:root {
  --bg: #0f1211;
  --panel: #171b1a;
  --panel-2: #1e2422;
  --line: #2c3330;
  --text: #e7ecea;
  --muted: #98a19d;
  --green: #1DB954;
  --green-600: #019F44;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.actions { display: flex; gap: 8px; }

button {
  font: inherit; font-weight: 600; color: #04140b; background: var(--green);
  border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { background: var(--panel-2); filter: none; }

main {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  /* palette + newsletter share the slack and grow; preview is capped at 650px
     (the email is never wider than 600) */
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 1fr) minmax(0, 650px);
  gap: 1px; background: var(--line);
}
.pane { background: var(--bg); padding: 16px; overflow-y: auto; min-height: 0; }
.pane h1 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 0 0 12px; font-weight: 700; }
.count { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.warning { color: #f3c969; font-size: 12px; margin: 0 0 10px; }

/* palette */
.cat { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 14px 0 6px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 8px;
}
.card h3 { margin: 0 0 3px; font-size: 14px; }
.card p { margin: 0 0 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.card .row { display: flex; gap: 6px; align-items: center; }
.card button { padding: 5px 10px; font-size: 12px; }
.tag { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.rep { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

/* stack list */
#stack-list, #locked-list { list-style: none; margin: 0; padding: 0; }
#stack-list li, #locked-list li {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 10px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
#stack-list li.sortable-ghost { opacity: .4; }
#stack-list li.sortable-chosen { border-color: var(--green); }
.drag { cursor: grab; color: var(--muted); font-size: 15px; line-height: 1; user-select: none; }
.li-body { flex: 1 1 auto; min-width: 0; }
.li-body .n { font-size: 14px; }
.li-body .d { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-x { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; }
.li-x:hover { color: #ff6b6b; filter: none; background: transparent; }
.locked-list li { opacity: .8; }
.lock { color: var(--muted); font-size: 13px; }

/* preview */
.preview { padding: 0; display: flex; flex-direction: column; }
.preview h1 { padding: 16px 16px 10px; }
.frame-wrap { flex: 1 1 auto; min-height: 0; background: #f2f2f2; overflow: auto; }
#preview { width: 100%; height: 100%; border: 0; background: #f2f2f2; }

/* dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 460px; width: 92%; }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin: 0 0 8px; font-size: 16px; }
dialog label { display: block; font-size: 12px; color: var(--muted); margin-top: 14px; }
dialog label small { color: var(--line); }
dialog input { width: 100%; margin-top: 5px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #04140b; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-auto-rows: minmax(220px, auto); }
  .pane { max-height: 60vh; }
}
