:root {
  --bg:       #f6f4ef;
  --panel:    #ffffff;
  --ink:      #1f1f1f;
  --muted:    #6b6b6b;
  --accent:   #e4572e;
  --teal:     #3b6b5c;
  --border:   #e6e2da;
  --shadow:   0 4px 20px rgba(31, 31, 31, 0.08);
  --radius:   16px;
  --font:     "Space Grotesk", system-ui, sans-serif;
  --mono:     "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

/* Ensure hidden attribute always wins over display: flex/block */
[hidden] { display: none !important; }

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at top left, #fef1e6 0%, #f6f4ef 45%),
              radial-gradient(ellipse at bottom right, #e7f0ec, transparent 60%);
  color: var(--ink);
  font-family: var(--font);
}

/* ── App shell ─────────────────────────────────────────────────────────── */
.app {
  flex: 1;
  min-height: 0;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.header-brand {
  flex: 1;
  min-width: 0;
}

.header-brand h1 {
  margin: 0 0 1px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

/* ── Brand logo: mini inline sequence diagram ────────────────────────────── */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  margin: 0 0 1px;
  font-family: var(--font);
  letter-spacing: 0;
}

.brand-actor {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(31,31,31,0.07);
}

.brand-actor-hot {
  border-color: var(--accent);
  color: var(--accent);
  background: #fff8f5;
}

.brand-wire {
  display: inline-block;
  width: 18px;
  height: 1.5px;
  background: var(--teal);
  flex-shrink: 0;
  position: relative;
  top: 0;
}

.brand-arrowhead {
  color: var(--teal);
  font-size: 9px;
  margin-left: -2px;
  margin-right: 0;
  line-height: 1;
}

.brand-down {
  font-size: 11px;
  color: var(--teal);
  font-family: var(--mono);
  font-weight: 500;
  margin-left: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-down em {
  font-style: normal;
  font-size: 10px;
  opacity: 0.7;
}

.tagline {
  font-size: 12px;
  color: var(--muted);
}

/* Connecting-mode SVG indicators */
svg.connecting .action-menu { display: none; }

svg.connecting .connect-hint .connect-ring  { opacity: 0; transition: opacity 0.12s; }
svg.connecting .connect-hint .connect-label { opacity: 0; transition: opacity 0.12s; }

svg.connecting .participant-group:hover .connect-ring  { opacity: 0.45; }
svg.connecting .participant-group:hover .connect-label { opacity: 1; }

/* Highlighted activation boxes — show which activations a return would affect */
.act-hl-source { animation: act-pulse-src 1s ease-in-out infinite alternate; }
.act-hl-target { animation: act-pulse-tgt 1s ease-in-out infinite alternate; }

@keyframes act-pulse-src {
  from { opacity: 0.7; }
  to   { opacity: 1;   }
}
@keyframes act-pulse-tgt {
  from { opacity: 0.6; }
  to   { opacity: 1;   }
}

/* Message drag handle — seq number column becomes a grab handle on hover */
.msg-drag-handle { opacity: 0.4; transition: opacity 0.1s; }
.msg-group:hover .msg-drag-handle { opacity: 1; }

/* Returnable activation boxes (top proc) — clickable to start a forced return */
.act-returnable {
  transition: filter 0.1s, stroke-width 0.1s;
}
.act-returnable:hover {
  filter: drop-shadow(0 0 3px rgba(59, 107, 92, 0.6));
  stroke-width: 2 !important;
}

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

.header-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font);
  line-height: 1;
  transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}
.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(228, 87, 46, 0.25);
}
.btn:active {
  transform: translateY(0);
  filter: brightness(0.97);
}
.btn.ghost {
  background: #f3efe7;
  color: var(--ink);
  border-color: var(--border);
}
.btn.ghost:hover {
  background: #fff;
  box-shadow: none;
  filter: none;
}
.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Export dropdown ───────────────────────────────────────────────────── */
.dl-dropdown {
  position: relative;
}
.dl-trigger {
  gap: 4px;
}
.dl-trigger.active {
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
.dl-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 148px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  padding: 4px 0;
  z-index: 300;
  animation: dl-pop 0.12s ease;
}
@keyframes dl-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  gap: 10px;
  text-align: left;
  transition: background 0.1s;
}
.dl-item:hover {
  background: #f3efe7;
}
.dl-ext {
  font-family: var(--mono);
  font-size: 10px;
  color: #a09890;
  font-weight: 400;
}

/* ── Diagram wrapper ───────────────────────────────────────────────────── */
.diagram-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #fffaf3;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}

.diagram-svg {
  display: block;
  min-width: 100%;
}

/* ── SVG hover-revealed elements ───────────────────────────────────────── */

/* Action menu pill [ ✎ | × ] — shared by participants and messages */
.action-menu {
  opacity: 0;
  transition: opacity 0.15s;
}
.participant-group:hover .action-menu,
.msg-group:hover .action-menu {
  opacity: 1;
}

/* Note text — only visible on hover */
.note-text {
  opacity: 0;
  transition: opacity 0.15s;
}
.participant-group:hover .note-text,
.msg-group:hover .note-text {
  opacity: 1;
}

/* ── Message kind tag (classification) ─────────────────────────────────── */
.kind-btn {
  opacity: 0;
  transition: opacity 0.15s;
}
.msg-group:hover .kind-btn {
  opacity: 1;
}
/* When a kind is set the tag is always visible */
.kind-btn.kind-set {
  opacity: 1;
}

/* Floating classification menu */
.kind-menu {
  position: fixed;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(31,31,31,0.13);
  padding: 4px 0;
  min-width: 194px;
  font-family: var(--font);
}

.kind-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink);
  transition: background 0.1s;
}
.kind-menu-item:hover { background: #f3efe7; }
.kind-menu-item.active { background: #f3efe7; font-weight: 600; }

.kind-menu-abbr {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 34px;
  text-align: center;
}

/* ── Floating panel (input + type toggle) ──────────────────────────────── */
.floating-panel {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.floating-input {
  display: block;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  text-align: center;
  box-shadow: 0 4px 16px rgba(228, 87, 46, 0.16);
}

.note-textarea {
  display: block;
  background: #fff;
  border: 2px solid var(--teal);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  width: 300px;
  min-height: 90px;
  line-height: 1.55;
  box-shadow: 0 4px 16px rgba(59, 107, 92, 0.16);
}

/* ── Type hint (Tab to toggle call/return) ─────────────────────────────── */
.type-hint {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  background: #fff;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  gap: 6px;
}

.empty-icon {
  font-size: 40px;
  opacity: 0.25;
  line-height: 1;
  margin-bottom: 8px;
}

.empty-state p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.empty-sub {
  font-size: 12px !important;
  opacity: 0.7;
}


/* ── Second accent button ──────────────────────────────────────────────── */
.btn.accent2 {
  background: var(--teal);
}
.btn.accent2:hover {
  box-shadow: 0 4px 12px rgba(59, 107, 92, 0.3);
}

/* ── Content area (sidebar + canvas side-by-side) ──────────────────────── */
.content-area {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 8px;
  align-items: stretch;
  overflow: hidden;
}

/* ── Library sidebar ───────────────────────────────────────────────────── */
.library {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  width: 252px;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: width 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.library.collapsed {
  width: 0;
  border-color: transparent;
  box-shadow: none;
}

.lib-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.library.collapsed .lib-inner {
  opacity: 0;
  pointer-events: none;
}

.lib-header {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lib-manage-btn {
  font-size: 10px;
  padding: 2px 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.lib-title {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Drag-to-resize handle between lib-inner and lib-toggle */
.lib-resize {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s;
  align-self: stretch;
}
.lib-resize:hover,
.lib-resize.resizing {
  background: rgba(228, 87, 46, 0.18);
}
.library.collapsed .lib-resize {
  display: none;
}
/* Disable width transition while dragging */
.library.resizing {
  transition: none !important;
}
/* When sidebar is collapsed the toggle arrow flips */
#library.collapsed + .lib-toggle {
  border-radius: 8px;
}

/* Collapse / expand toggle — standalone between sidebar and canvas */
.lib-toggle {
  flex-shrink: 0;
  align-self: flex-start;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.lib-toggle:hover {
  background: #f3efe7;
  color: var(--ink);
}

.rb-search {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  background: #faf8f4;
  box-sizing: border-box;
}
.rb-search:focus { border-color: var(--accent); background: #fff; }

.rb-filters {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rb-filter-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: #faf8f4;
  outline: none;
  cursor: pointer;
  transition: border-color 0.12s;
}
.rb-filter-select:focus { border-color: var(--accent); background: #fff; }

.rb-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  min-height: 0;
}

.rb-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.rb-group { margin-bottom: 4px; }

.rb-repo-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 16px 2px;
}

.rb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  transition: background 0.1s;
}
.rb-row:hover { background: #f3efe7; }
.rb-row-repo { opacity: 0.6; font-style: italic; }
.rb-row-repo:hover { opacity: 1; }

.rb-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 62px;
  text-align: center;
}
.rb-badge-repo       { background: #e6e2da; color: #6b6b6b; }
.rb-badge-controller { background: #fde8e0; color: #c0391f; }
.rb-badge-service    { background: #e0eeeb; color: #2a5a4a; }
.rb-badge-business   { background: #e8e4f8; color: #4a3a80; }

.rb-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Diagram title input ────────────────────────────────────────────────── */
.diagram-title-input {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  outline: none;
  width: 150px;
  transition: border-color 0.15s, background 0.15s;
}
.diagram-title-input:hover {
  border-color: var(--border);
  background: #faf8f4;
}
.diagram-title-input:focus {
  border-color: var(--accent);
  background: #fff;
}

/* ── Account avatar (logged-in state) ──────────────────────────────────── */
.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.account-avatar:hover { opacity: 0.82; }

/* ── Modal overlay ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(31, 31, 31, 0.18);
  width: 100%;
  max-width: 380px;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box-wide { max-width: 520px; }
.modal-box-sm   { max-width: 320px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}
.modal-close:hover { color: var(--ink); background: #f3efe7; }

/* Inline close (inside flex header) */
.modal-close-inline {
  position: static;
  margin-left: auto;
}

/* ── Auth modal ─────────────────────────────────────────────────────────── */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.modal-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.modal-tab:hover:not(.active) { color: var(--ink); }

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  background: #faf8f4;
  box-sizing: border-box;
  transition: border-color 0.12s, background 0.12s;
}
.modal-input:focus { border-color: var(--accent); background: #fff; }

.modal-error {
  font-size: 12px;
  color: var(--accent);
  padding: 4px 0 0;
}

/* ── Diagrams modal ─────────────────────────────────────────────────────── */
.modal-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.diagrams-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 420px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.diagrams-empty {
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.diagram-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}
.diagram-row:hover { background: #f3efe7; }
.diagram-row.active {
  border-left-color: var(--teal);
  background: #f0f6f4;
}

.diagram-row-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diagram-row-date {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  flex-shrink: 0;
  white-space: nowrap;
}
.diagram-row-del {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.1s;
  flex-shrink: 0;
}
.diagram-row:hover .diagram-row-del { opacity: 1; }
.diagram-row-del:hover { background: #fde8e0; color: var(--accent); }

/* ── About modal ────────────────────────────────────────────────────────── */
.about-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 0 8px;
}
.about-desc {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}
.about-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.about-credit strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.about-links {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.about-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.12s, border-color 0.12s;
}
.about-link:hover { background: #f3efe7; border-color: #d4cfc7; }

/* ── Library management modal ───────────────────────────────────────────── */
.lib-modal-body {
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 0 8px;
  display: flex;
  flex-direction: column;
}

.lib-add-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lib-add-form-col {
  flex-direction: column;
  align-items: stretch;
}

.lib-add-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  background: #faf8f4;
  box-sizing: border-box;
  min-width: 0;
  transition: border-color 0.12s;
}
.lib-add-input:focus { border-color: var(--accent); background: #fff; }

.lib-add-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  background: #faf8f4;
  cursor: pointer;
  transition: border-color 0.12s;
  flex-shrink: 0;
}
.lib-add-select:focus { border-color: var(--accent); }

.lib-color-swatches {
  display: flex;
  gap: 6px;
  padding: 4px 0 2px;
  flex-wrap: wrap;
}
.lib-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.lib-color-dot:hover { transform: scale(1.15); }
.lib-color-dot.selected {
  border-color: var(--ink);
  transform: scale(1.1);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--ink);
}

.lib-group-hdr {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 10px 20px 4px;
}

.lib-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  transition: background 0.1s;
}
.lib-item-row-clickable { cursor: pointer; }
.lib-item-row:hover { background: #f3efe7; }
.lib-item-row-editing {
  background: #f0f6f4;
  border-left: 3px solid var(--teal);
}

.lib-item-name {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.lib-item-count {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  font-family: var(--mono);
}

.lib-cat-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lib-item-del {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.1s;
  flex-shrink: 0;
}
.lib-item-row:hover .lib-item-del { opacity: 1; }
.lib-item-del:hover { background: #fde8e0; color: var(--accent); }
.lib-item-del:disabled { opacity: 0.25; cursor: not-allowed; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app      { padding: 8px; }
  .header   { flex-direction: column; align-items: flex-start; }

}
