/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --header-h: 56px;
  --sidebar-w: 180px;
  --middle-w: 215px;
  --bg: #f5f4f2;
  --surface: #ffffff;
  --border: #e4e2dd;
  --text: #1a1a1a;
  --sub: #888;
  --accent: #1a1a1a;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}
body {
  font-family: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

/* ── Loading overlay ────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--sub);
  font-size: 14px;
}

/* ── Header ──────────────────────────────────────────────────── */
#app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 200;
}
.logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav {
  display: flex;
  gap: 4px;
}
.nav-btn {
  padding: 8px 22px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
  font-family: 'Pretendard', sans-serif;
}
.nav-btn:hover { background: var(--bg); }
.nav-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
#username-label { font-size: 13px; font-weight: 500; }
.avatar-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s;
}
.avatar-circle:hover { border-color: var(--accent); }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tab { display: none; flex: 1; overflow: hidden; }
.tab.active { display: flex; flex-direction: column; }

/* ── Buttons ─────────────────────────────────────────────────── */
.icon-btn {
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: 6px;
  color: var(--sub); display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.sm { padding: 3px; }
.pill-btn {
  padding: 6px 14px; border-radius: 20px;
  background: var(--accent); color: #fff; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
  font-family: 'Pretendard', sans-serif;
}
.pill-btn:hover { background: #333; }
.pill-btn.secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.pill-btn.secondary:hover { border-color: var(--accent); background: var(--bg); }
.save-btn {
  padding: 7px 20px; border-radius: 20px;
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
  font-family: 'Pretendard', sans-serif;
}
.save-btn:hover { background: #333; }
.tool-btn {
  padding: 7px 16px; border-radius: 20px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); font-size: 13px;
  cursor: pointer; transition: background 0.1s;
  font-family: 'Pretendard', sans-serif;
}
.tool-btn:hover { background: var(--bg); }
.tool-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.select-sm {
  padding: 6px 10px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; cursor: pointer; outline: none;
  font-family: 'Pretendard', sans-serif;
}

/* View toggle */
.view-toggle {
  display: flex; gap: 1px;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.view-btn {
  background: none; border: none; cursor: pointer;
  padding: 5px 7px; color: var(--sub);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.view-btn:hover { background: var(--bg); color: var(--text); }
.view-btn.active { background: var(--accent); color: #fff; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: var(--sub);
  font-size: 13px; gap: 6px; text-align: center; padding: 20px;
  pointer-events: none;
}
.empty-state .sub { font-size: 11px; opacity: 0.7; }

/* ══════════════════════════════════════════════════════════════
   BOARD TAB
   ══════════════════════════════════════════════════════════════ */
#tab-board { flex-direction: column; }

.board-top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px 12px;
  flex-shrink: 0;
}
.board-top-header {
  display: flex; align-items: center;
  margin-bottom: 12px;
}
.section-title { font-size: 14px; font-weight: 700; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* Board search */
.board-search-wrap {
  display: flex; align-items: center; gap: 6px;
  margin-left: 18px; flex: 0 1 320px;
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg);
  transition: border-color 0.15s;
}
.board-search-wrap:focus-within { border-color: var(--accent); background: var(--surface); }
.board-search-icon { color: var(--sub); flex-shrink: 0; }
.board-search-input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 12px; font-family: 'Pretendard', sans-serif; color: var(--text);
  min-width: 0;
}
.board-search-input::placeholder { color: var(--sub); }
.board-search-clear {
  border: none; background: var(--border); color: var(--sub);
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 9px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.board-search-clear:hover { background: #ccc; color: var(--text); }
.board-search-clear.hidden { display: none; }

/* Group block dim when filtered out */
.pin-card.search-hidden, .folder-card.search-hidden { display: none; }

/* Custom classify row */
.custom-classify-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.custom-classify-row.hidden { display: none; }
.custom-classify-row input {
  flex: 1; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 12px; outline: none;
  font-family: 'Pretendard', sans-serif;
}
.custom-classify-row input:focus { border-color: var(--accent); }

/* Folder row */
.folder-row {
  display: flex; gap: 12px;
  overflow-x: auto; padding-bottom: 2px;
  min-height: 80px; align-items: flex-start;
}
.folder-row.view-list {
  flex-direction: column; gap: 4px;
  min-height: unset;
}
.folder-row::-webkit-scrollbar { height: 3px; }
.folder-empty { color: var(--sub); font-size: 12px; align-self: center; }

/* Folder cards - default (medium) */
.folder-card {
  flex-shrink: 0; width: 110px; cursor: pointer;
  border-radius: var(--radius); overflow: hidden;
  border: 2px solid transparent; transition: border-color 0.15s, opacity 0.15s;
  background: var(--surface);
  user-select: none;
}
.folder-card.active { border-color: var(--accent); }
.folder-card:hover { border-color: #ccc; }
.folder-card.drag-over { border-color: var(--accent); opacity: 0.7; }
.folder-card.dragging { opacity: 0.4; }

/* Small view */
.folder-row.view-small .folder-card { width: 80px; }
.folder-row.view-small .folder-thumb { height: 52px; }
.folder-row.view-small .folder-info { padding: 4px 5px; }
.folder-row.view-small .folder-name-text { font-size: 10px; }
.folder-row.view-small .folder-count { display: none; }

/* Large view */
.folder-row.view-large .folder-card { width: 160px; }
.folder-row.view-large .folder-thumb { height: 110px; }

/* List view */
.folder-row.view-list .folder-card {
  width: 100%; display: flex; align-items: center;
  border-radius: 6px; padding: 0;
}
.folder-row.view-list .folder-thumb,
.folder-row.view-list .folder-thumb-empty { width: 40px; height: 40px; border-radius: 6px 0 0 6px; flex-shrink: 0; }
.folder-row.view-list .folder-info { flex: 1; padding: 0 10px; }
.folder-row.view-list .folder-count { font-size: 11px; }

.folder-thumb {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--border);
  height: 72px; overflow: hidden;
}
.folder-thumb img { width: 100%; height: 100%; object-fit: cover; }
.folder-thumb-empty { width: 100%; height: 72px; background: var(--bg); }
.folder-info { padding: 6px 7px; background: var(--surface); }
.folder-name-text { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-count { font-size: 10px; color: var(--sub); }

/* Pin section */
.pin-section {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.pin-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.pin-folder-label {
  font-size: 12px; color: var(--sub);
  padding: 2px 8px; border-radius: 12px;
  background: var(--bg);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pin-area { flex: 1; overflow-y: auto; padding: 16px 24px; }
.pin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.pin-card {
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 3/4; background: var(--border);
  position: relative; cursor: pointer;
  transition: opacity 0.15s;
  user-select: none;
}
.pin-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin-card.dragging { opacity: 0.4; }
.pin-card.drag-over::after {
  content: ''; position: absolute; inset: 0;
  border: 3px dashed var(--accent); border-radius: var(--radius);
  pointer-events: none;
}
.pin-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s;
}
.pin-card:hover .pin-actions { opacity: 1; }
.pin-action {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: none;
  font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Pin group blocks */
.group-block { margin-bottom: 24px; }
.group-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.group-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.group-name { font-size: 13px; font-weight: 600; }
.group-count { font-size: 12px; color: var(--sub); }

/* ══════════════════════════════════════════════════════════════
   THREE-COLUMN LAYOUT
   ══════════════════════════════════════════════════════════════ */
.three-col { display: flex; flex: 1; overflow: hidden; }

.left-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-section { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-sec-header {
  display: flex; align-items: center;
  padding: 8px 12px; flex-shrink: 0;
}
.sidebar-sec-header span {
  flex: 1; font-size: 11px; font-weight: 700;
  color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px;
}

/* File tree */
.file-tree { flex: 1; overflow-y: auto; padding: 2px 0; }

.tree-folder-row {
  display: flex; align-items: center;
  padding: 5px 8px; gap: 5px;
  font-size: 12px; cursor: pointer;
  border-radius: 5px; margin: 1px 4px;
  user-select: none;
}
.tree-folder-row:hover { background: var(--bg); }
.tree-folder-row.selected { background: #ebebeb; font-weight: 600; }
.tree-folder-row.drag-over { background: #e0f0ff; }

.tree-file-row {
  display: flex; align-items: center;
  padding: 4px 8px 4px 24px; gap: 5px;
  font-size: 12px; cursor: pointer;
  border-radius: 5px; margin: 1px 4px 1px 8px;
  user-select: none;
  color: var(--sub);
}
.tree-file-row:hover { background: var(--bg); color: var(--text); }
.tree-file-row.selected { background: #ebebeb; font-weight: 600; color: var(--text); }
.tree-file-row.dragging { opacity: 0.4; }

.tree-toggle {
  width: 14px; flex-shrink: 0;
  font-size: 10px; color: var(--sub);
  display: flex; align-items: center; justify-content: center;
}
.tree-icon { font-size: 11px; flex-shrink: 0; }
.tree-label {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Middle panel */
.middle-panel {
  width: var(--middle-w); flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
}
.middle-header {
  padding: 10px 12px; font-size: 12px; font-weight: 600;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-grid {
  flex: 1; overflow-y: auto; padding: 8px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 5px; align-content: start;
}
.board-thumb {
  aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  background: var(--bg); cursor: grab; position: relative;
  transition: transform 0.1s;
}
.board-thumb:hover { transform: scale(1.03); }
.board-thumb:hover::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(0,0,0,0.08); border-radius: 6px;
}
.board-thumb:active { cursor: grabbing; }
.board-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

/* ══════════════════════════════════════════════════════════════
   EDITOR MAIN
   ══════════════════════════════════════════════════════════════ */
.editor-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.editor-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.file-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--sub); }
.canvas-area {
  flex: 1; overflow: auto;
  background: #e8e6e2;
  padding: 24px;
  display: flex; align-items: flex-start; justify-content: flex-start;
}
.canvas-wrapper {
  position: relative;
  flex-shrink: 0;
}
#editor-canvas {
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  display: block;
  transform-origin: 0 0;
}
.canvas-resize-handle {
  position: absolute;
  bottom: -18px; right: -18px;
  width: 24px; height: 24px;
  cursor: se-resize;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.1s;
  z-index: 5;
}
.canvas-resize-handle:hover { background: var(--bg); }

/* Text input overlay */
.text-input-overlay {
  position: absolute;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  min-width: 260px;
}
.text-input-overlay.hidden { display: none; }
#text-input-field {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; outline: none; margin-bottom: 8px;
  font-family: 'Pretendard', sans-serif;
}
#text-input-field:focus { border-color: var(--accent); }
.text-input-bar {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
}
.text-input-bar label { color: var(--sub); white-space: nowrap; }
#text-font-size {
  width: 56px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; outline: none;
  font-family: 'Pretendard', sans-serif;
}

.editor-bottombar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--surface);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.zoom-spacer { flex: 1; }
.zoom-label {
  font-size: 12px; color: var(--sub);
  font-weight: 600; white-space: nowrap;
  padding: 4px 10px;
  background: var(--bg); border-radius: 12px;
}

/* ══════════════════════════════════════════════════════════════
   EDITOR — RIGHT PROPERTIES PANEL
   ══════════════════════════════════════════════════════════════ */
.right-panel {
  width: 200px; flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; padding: 12px;
  gap: 14px;
}
.props-section {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.props-section:last-child { border-bottom: none; padding-bottom: 0; }
.props-section.hidden { display: none; }
.props-section-title {
  font-size: 11px; font-weight: 700;
  color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px;
}
.props-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 12px;
}
.props-row label { color: var(--text); white-space: nowrap; }
.props-row label.checkbox-label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.props-row input[type="number"] {
  width: 64px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; outline: none;
  font-family: 'Pretendard', sans-serif;
}
.props-row input[type="number"].full,
.select-sm.full { width: 110px; }
.props-row input[type="color"] {
  width: 32px; height: 28px; padding: 0;
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; background: none;
}
.select-sm.full { padding: 5px 6px; }
.props-hint { font-size: 10.5px; color: var(--sub); line-height: 1.5; }

.shape-add-row { display: flex; gap: 6px; }
.tool-btn.sm {
  padding: 6px 9px; font-size: 12px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.btn-group { display: flex; gap: 4px; }
.btn-group .tool-btn.sm { flex: 1; padding: 6px 4px; font-size: 11px; }
.btn-group .tool-btn.sm.active,
.tool-btn.sm.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.layer-btn-row { display: flex; gap: 4px; }
.layer-btn-row .tool-btn.sm { flex: 1; padding: 6px 4px; font-size: 11px; }
.danger-text { color: #d03030; }
.danger-text:hover { background: #fdecec; border-color: #f0b8b8; }

/* ══════════════════════════════════════════════════════════════
   COLOR PICK MAIN (redesigned)
   ══════════════════════════════════════════════════════════════ */
.cp-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.cp-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cp-file-label { flex: 1; font-size: 12px; font-weight: 600; color: var(--sub); }
.cp-work-area {
  flex: 1; display: flex; gap: 0; overflow: hidden; min-height: 0;
}

/* Canvas area for color picking */
.cp-canvas-area {
  flex: 1; position: relative;
  background: #e8e6e2;
  overflow: auto;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 20px; min-width: 0;
}
.cp-canvas-wrapper {
  position: relative; flex-shrink: 0;
}
#cp-canvas {
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  display: block;
  transform-origin: 0 0;
}
#cp-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
  gap: 6px;
}
#cp-empty .pill-btn { pointer-events: auto; margin-top: 8px; }

/* Right: My Colors (Pantone-style chip cards) */
.cp-colors-panel {
  width: 210px; flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 12px;
  gap: 10px;
}
.cp-colors-header {
  font-size: 10px; font-weight: 700;
  color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px;
}
.picked-grid {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 6px; align-content: start;
}
.picked-empty { font-size: 11px; color: var(--sub); padding: 6px 2px; line-height: 1.5; }
.color-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer; position: relative;
  transition: background 0.1s, border-color 0.1s;
}
.color-chip:hover { background: var(--bg); border-color: #ccc; }
.color-chip-swatch {
  width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.08);
}
.color-chip-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.color-chip-num { font-size: 9px; font-weight: 700; color: var(--sub); letter-spacing: 0.4px; }
.color-chip-hex { font-size: 11.5px; font-weight: 700; font-family: 'SFMono-Regular', Consolas, monospace; }
.color-chip-name { font-size: 10px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-remove {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: #ddd; border: none; font-size: 9px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.1s;
}
.color-chip:hover .chip-remove { opacity: 1; }
.chip-remove:hover { background: #ccc; }

/* Auto-swatch strip */
.auto-swatch-strip {
  padding: 10px 16px 14px; background: var(--surface);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.strip-label {
  display: block; font-size: 10px; font-weight: 700;
  color: var(--sub); text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.swatch-row { display: flex; flex-wrap: wrap; gap: 16px; }
.swatch-row-empty { font-size: 11px; color: var(--sub); }
.swatch-chip {
  width: 64px; cursor: grab;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform 0.1s; flex-shrink: 0;
}
.swatch-chip:hover { transform: translateY(-3px); }
.swatch-chip .swatch-color {
  width: 64px; height: 64px; border-radius: 10px;
  border: 2px solid var(--border); transition: border-color 0.1s;
}
.swatch-chip:hover .swatch-color { border-color: var(--accent); }
.swatch-chip .swatch-hex {
  font-size: 10px; font-weight: 700; font-family: 'SFMono-Regular', Consolas, monospace;
}
.swatch-chip .swatch-name {
  font-size: 9px; color: var(--sub); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px;
}

/* Color-pick board folder flyout */
.cp-board-flyout { padding: 8px; min-width: 180px; max-width: 220px; }
.cp-flyout-title {
  font-size: 10px; font-weight: 700; color: var(--sub);
  padding: 2px 4px 6px; text-transform: uppercase; letter-spacing: 0.4px;
}
.cp-flyout-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
  max-height: 220px; overflow-y: auto;
}
.cp-flyout-grid .board-thumb { aspect-ratio: 1; border-radius: 5px; overflow: hidden; cursor: pointer; }
.cp-flyout-grid .board-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cp-flyout-empty { font-size: 11px; color: var(--sub); padding: 8px 4px; }

/* Picker button */
.picker-btn {
  padding: 7px 16px; border-radius: 20px;
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
  font-family: 'Pretendard', sans-serif;
}
.picker-btn:hover { background: #333; }
.picker-btn.active { background: #e05555; }

/* ══════════════════════════════════════════════════════════════
   CUTOUT MODAL
   ══════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: 14px;
  padding: 24px; width: 500px; max-width: 92vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.cutout-preview-bg {
  background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  height: 280px;
}
#cutout-canvas { max-width: 100%; max-height: 100%; display: block; }
.cutout-controls {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 13px;
}
.ctrl-label { font-weight: 600; white-space: nowrap; min-width: 80px; }
.cutout-controls input[type=range] { flex: 1; }
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
}

/* ══════════════════════════════════════════════════════════════
   CONTEXT MENU & DROPDOWN
   ══════════════════════════════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.12);
  z-index: 500; overflow: hidden; min-width: 140px;
}
.ctx-menu.hidden { display: none; }
.ctx-menu button {
  display: block; width: 100%;
  text-align: left; padding: 8px 14px;
  background: none; border: none;
  font-size: 13px; cursor: pointer;
  font-family: 'Pretendard', sans-serif;
}
.ctx-menu button:hover { background: var(--bg); }
.ctx-menu button.danger { color: #d03030; }
.ctx-menu button.hidden { display: none; }

/* ══════════════════════════════════════════════════════════════
   COLOR TOOLTIP
   ══════════════════════════════════════════════════════════════ */
.color-tooltip {
  position: fixed; pointer-events: none; z-index: 800;
  background: rgba(0,0,0,0.72); color: #fff;
  border-radius: 8px; padding: 6px 10px; font-size: 12px;
  display: flex; align-items: center; gap: 8px;
  transform: translate(-50%, calc(-100% - 14px));
}
.color-tooltip.hidden { display: none; }
.tooltip-color { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.2); }

/* ══════════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
