*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg0: #0d1117;
  --bg1: #161b27;
  --bg2: #1e2535;
  --bg3: #2d3748;
  --border: #2a3347;
  --text: #e2e8f0;
  --text-muted: #718096;
  --text-dim: #4a5568;
  --accent: #3b82f6;
  --accent-light: #63b3ed;
  --yellow: #f6e05e;
  --red: #fc8181;
  --green: #68d391;
  --teal: #4fd1c5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg0);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

/* ── Toolbar ───────────────────────────────────────────────────── */
#toolbar {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 50px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  gap: 4px;
  flex-shrink: 0;
  user-select: none;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.app-logo svg { color: var(--accent-light); }

.sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
  background: transparent;
  color: var(--text-muted);
}
.btn:hover { background: var(--bg3); color: var(--text); border-color: var(--bg3); }

.btn-tool { border-color: var(--border); background: var(--bg2); }
.btn-tool:hover { background: var(--bg3); border-color: var(--bg3); color: var(--text); }
.btn-tool.active {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── Prefix row (sidebar) ──────────────────────────────────────── */
.prefix-row {
  display: flex;
  align-items: center;
  padding: 5px 8px 6px;
  gap: 7px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.prefix-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  user-select: none;
  flex-shrink: 0;
}
.prefix-input {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  padding: 3px 7px;
  outline: none;
  transition: border-color 0.12s;
}
.prefix-input:focus { border-color: var(--accent); }

.btn kbd {
  display: inline-block;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 10px;
  font-family: monospace;
  line-height: 14px;
  color: var(--text-dim);
  margin-left: 2px;
}
.btn.active kbd { color: var(--accent-light); opacity: 0.7; }

/* ── Main ──────────────────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
#sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section-header {
  padding: 9px 12px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#ann-count {
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  padding: 1px 6px;
  letter-spacing: 0;
}

#annotation-list {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
}
#annotation-list::-webkit-scrollbar { width: 4px; }
#annotation-list::-webkit-scrollbar-track { background: transparent; }
#annotation-list::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

.ann-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
  gap: 7px;
  margin-bottom: 1px;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.ann-item:hover { background: var(--bg2); }
.ann-item.selected { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

.ann-type-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ann-name-input {
  flex: 1;
  font-size: 12.5px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  min-width: 0;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1px 0;
}
.ann-name-input:focus {
  background: var(--bg3);
  border-radius: 3px;
  padding: 1px 4px;
  cursor: text;
}

.ann-del-btn {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
  padding: 0;
}
.ann-item:hover .ann-del-btn { opacity: 1; }
.ann-del-btn:hover { color: var(--red); background: var(--bg3); }

/* Tag edit button on annotation rows */
.tag-edit-btn {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
  padding: 0;
}
.ann-item:hover .tag-edit-btn { opacity: 1; }
.tag-edit-btn:hover { color: var(--accent-light); background: var(--bg3); }
.tag-edit-btn.active { opacity: 1; color: var(--accent-light); }

/* Expanded tag editor */
.ann-tag-editor {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 4px 0 2px 23px;
}
.tag-editor-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 5px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg2);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  user-select: none;
}
.tag-editor-chip:hover { background: var(--bg3); color: var(--text); }
.tag-editor-chip.has-tag {
  color: var(--text);
  background: var(--bg3);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.tag-editor-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tag-editor-done {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  margin-left: 2px;
}
.tag-editor-done:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Tags panel ────────────────────────────────────────────────── */
#tags-panel {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  max-height: 190px;
  min-height: 38px;
}

#tags-list {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
}
#tags-list::-webkit-scrollbar { width: 4px; }
#tags-list::-webkit-scrollbar-track { background: transparent; }
#tags-list::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

.tag-item {
  display: flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
  gap: 7px;
  margin-bottom: 1px;
  border: 1px solid transparent;
  transition: background 0.1s;
  user-select: none;
}
.tag-item:hover { background: var(--bg2); }
.tag-item.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,0.2);
}
.tag-item.active .tag-dot { box-shadow: 0 0 0 2px var(--bg1), 0 0 0 3.5px rgba(255,255,255,0.25); }

.tag-name {
  flex: 1;
  font-size: 12.5px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-add-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.tag-add-btn:hover { background: var(--bg3); color: var(--text); }

.tag-del-btn {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
  padding: 0;
}
.tag-item:hover .tag-del-btn { opacity: 1; }
.tag-del-btn:hover { color: var(--red); background: var(--bg3); }

.tag-new-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 12.5px;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
}

/* Tag dots inside annotation list rows */
.ann-tag-dots {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.ann-tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Zoom viewer ───────────────────────────────────────────────── */
#zoom-panel {
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding: 8px;
  background: var(--bg0);
}

.zoom-header {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.zoom-factor { color: var(--text-dim); font-size: 10px; }

#zoom-canvas {
  display: block;
  width: 100%;
  height: 148px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg2);
}

/* ── Canvas area ───────────────────────────────────────────────── */
#canvas-area {
  flex: 1;
  overflow: auto;
  background: var(--bg0);
  background-image: radial-gradient(circle, #2d3748 1px, transparent 1px);
  background-size: 20px 20px;
  position: relative;
}
#canvas-area::-webkit-scrollbar { width: 8px; height: 8px; }
#canvas-area::-webkit-scrollbar-track { background: var(--bg0); }
#canvas-area::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

#drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  user-select: none;
  pointer-events: none;
}
#drop-zone.drag-over { color: var(--accent-light); }
#drop-zone svg { opacity: 0.4; }
#drop-zone h2 { font-size: 17px; font-weight: 500; color: var(--text-muted); }
#drop-zone p { font-size: 12.5px; }

#canvas-wrapper {
  position: relative;
  display: none;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 1px var(--border);
  border-radius: 2px;
}

#main-canvas {
  display: block;
  touch-action: none;
}

#coords-hud {
  position: fixed;
  bottom: 30px;  /* 22px status bar + 8px gap */
  right: 8px;
  background: rgba(0,0,0,0.75);
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.07);
}

/* ── Status bar ────────────────────────────────────────────────── */
#statusbar {
  height: 22px;
  background: var(--bg1);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  user-select: none;
}
#status-mode { color: var(--accent-light); font-weight: 600; }
#status-hint { margin-left: auto; color: var(--text-dim); }
.sb-key {
  display: inline-block;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 9.5px;
  font-family: monospace;
}

/* ── Tools menu ────────────────────────────────────────────────── */
.tools-menu {
  position: relative;
}

.btn-tools {
  color: var(--teal);
  border-color: var(--border);
  gap: 5px;
}
.btn-tools:hover {
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  border-color: var(--teal);
  color: var(--teal);
}
.btn-tools.open {
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  border-color: var(--teal);
  color: var(--teal);
}
.tools-chevron { transition: transform 0.15s; }
.btn-tools.open .tools-chevron { transform: rotate(180deg); }

.tools-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
  z-index: 100;
}
.tools-dropdown.open { display: block; }

.tools-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s;
}
.tools-dropdown-item:hover { background: var(--bg3); }

.tools-item-icon { color: var(--teal); flex-shrink: 0; }

.tools-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tools-item-name { font-size: 13px; color: var(--text); font-weight: 500; }
.tools-item-desc { font-size: 11px; color: var(--text-dim); }

/* ── File menu ─────────────────────────────────────────────────── */
.file-menu {
  position: relative;
}

.btn-file-menu {
  border-color: var(--border);
  gap: 5px;
}
.btn-file-menu:hover {
  background: var(--bg3);
  border-color: var(--bg3);
  color: var(--text);
}
.btn-file-menu.open {
  background: var(--bg3);
  border-color: var(--bg3);
  color: var(--text);
}
.file-chevron { transition: transform 0.15s; }
.btn-file-menu.open .file-chevron { transform: rotate(180deg); }

.file-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
  z-index: 100;
}
.file-dropdown.open { display: block; }

.file-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}
.file-dropdown-item:hover { background: var(--bg3); }

.file-item-icon { color: var(--text-muted); flex-shrink: 0; }
.file-item-danger { color: var(--red); }
.file-item-danger .file-item-icon { color: var(--red); }
.file-item-danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }

.file-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 4px;
}

/* ── Tool modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 400px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 5px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.1s, color 0.1s;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }

.modal-body { padding: 16px 20px; }

.modal-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 16px;
}
.modal-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.modal-select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 7px 32px 7px 10px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.12s;
}
.modal-select:focus { border-color: var(--accent); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.btn-modal-cancel {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.btn-modal-cancel:hover { background: var(--bg3); color: var(--text); }
.btn-modal-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 7px;
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.1s;
}
.btn-modal-primary:hover { opacity: 0.85; }

/* ── Hidden inputs ─────────────────────────────────────────────── */
#file-input, #json-input { display: none; }

/* ── Theme icon button ─────────────────────────────────────────── */
.btn-theme-icon {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn-theme-icon:hover { background: var(--bg3); color: var(--text); border-color: var(--bg3); }
.btn-theme-icon .icon-moon { display: none; }
body.light .btn-theme-icon .icon-sun { display: none; }
body.light .btn-theme-icon .icon-moon { display: block; }

/* ── Light theme ───────────────────────────────────────────────── */
body.light {
  --bg0: #f0f2f5;
  --bg1: #ffffff;
  --bg2: #f0f2f5;
  --bg3: #dde1e8;
  --border: #d0d5de;
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-dim: #a0aec0;
  --accent: #2563eb;
  --accent-light: #1d4ed8;
}
body.light #canvas-area {
  background-image: radial-gradient(circle, #c8cdd6 1px, transparent 1px);
}
body.light #coords-hud {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.1);
  color: var(--text-muted);
}
body.light #canvas-wrapper {
  box-shadow: 0 4px 24px rgba(0,0,0,0.15), 0 0 0 1px var(--border);
}
body.light #zoom-canvas { background: var(--bg3); }

/* ── Tag count badge ───────────────────────────────────────────── */
.tag-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg3);
  border-radius: 8px;
  padding: 1px 5px;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* ── Tag eye toggle ────────────────────────────────────────────── */
.tag-eye-btn {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
  padding: 0;
}
.tag-item:hover .tag-eye-btn { opacity: 1; }
.tag-eye-btn.hidden-tag { opacity: 1; color: var(--accent-light); }
.tag-eye-btn:hover { color: var(--accent-light); background: var(--bg3); }

/* ── Tag dot color-picker button ───────────────────────────────── */
.tag-dot-btn {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,0.2);
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s;
}
.tag-dot-btn:hover { transform: scale(1.35); }
.tag-item.active .tag-dot-btn { box-shadow: 0 0 0 2px var(--bg1), 0 0 0 3.5px rgba(255,255,255,0.25); }

/* ── Color picker popover ──────────────────────────────────────── */
.color-picker-popover {
  position: fixed;
  z-index: 300;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 112px;
}
.color-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  padding: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; }
.color-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.color-native-input {
  width: 28px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  padding: 1px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}
.color-custom-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── Hidden annotation dimming ─────────────────────────────────── */
.ann-item.ann-hidden { opacity: 0.38; }
