/* ══════════════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════════════ */
:root {
  --bg:          #ffffff;
  --panel:       #fafafa;
  --panel-dark:  #f2f2f2;
  --panel-mid:   #ebebeb;
  --line-soft:   #e6e6e6;
  --line-mid:    #d0d0d0;
  --ink:         #0a0a0a;
  --ink-soft:    #2b2b2b;
  --muted:       #6b6b6b;
  --accent:      #0a0a0a;
  --accent-hi:   #1a1a1a;
  --accent-text: #ffffff;
  --accent-blue: #1a6cf6;
  --danger:      #c0392b;
  --success:     #16a34a;

  --topbar-h:    44px;
  --sidebar-lw:  220px;
  --sidebar-rw:  260px;
  --trans:       0.12s ease;

  --font-sans:   'Inter', -apple-system, system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

body.dark {
  --bg:          #141414;
  --panel:       #1e1e1e;
  --panel-dark:  #252525;
  --panel-mid:   #202020;
  --line-soft:   #2a2a2a;
  --line-mid:    #3a3a3a;
  --ink:         #f0f0f0;
  --ink-soft:    #d0d0d0;
  --muted:       #888888;
  --accent:      #f0f0f0;
  --accent-hi:   #ffffff;
  --accent-text: #0a0a0a;
}

/* ══════════════════════════════════════════════════════
   RESET
══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: var(--ink); color: var(--bg); }
::placeholder { color: var(--muted); opacity: 1; }
h1, h2, h3 { font-weight: 400; margin: 0; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; outline: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }
a { text-decoration: none; color: inherit; }

/* ══════════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  z-index: 100;
}
.topbar-left  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.brand {
  display: flex; align-items: center; gap: 8px;
  user-select: none;
}
.logo { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.logo-mark {
  display: block; width: 18px; height: 18px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 60% 100%, 0 100%);
}
.brand-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.search-wrap {
  position: relative;
  width: 360px;
  max-width: 100%;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 12px;
  transition: border-color var(--trans), background var(--trans);
}
.search-input:focus {
  border-color: var(--ink);
  background: var(--bg);
}

.tb-util-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}
.tb-util-btn:hover {
  color: var(--ink);
  border-color: var(--line-soft);
  background: var(--panel-dark);
}

.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════ */
.app-layout {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
}

/* ══════════════════════════════════════════════════════
   LEFT SIDEBAR
══════════════════════════════════════════════════════ */
.sidebar-left {
  width: var(--sidebar-lw);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 8px;
  gap: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 2px;
  transition: background var(--trans), color var(--trans);
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--panel-mid); color: var(--ink); }
.nav-item.active { background: var(--panel-dark); color: var(--ink); font-weight: 500; }
.nav-item svg { flex-shrink: 0; }

.sidebar-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 10px 0;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px;
}

.spaces-list,
.labels-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.space-item,
.label-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 2px;
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
}
.space-item:hover,
.label-item:hover { background: var(--panel-mid); color: var(--ink); }
.space-item.active,
.label-item.active { background: var(--panel-dark); color: var(--ink); }

.space-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.label-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sidebar-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  transition: color var(--trans);
  width: 100%;
  text-align: left;
}
.sidebar-new-btn:hover { color: var(--ink); }

/* ══════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
}
.breadcrumb-item {
  color: var(--muted);
  cursor: pointer;
  transition: color var(--trans);
}
.breadcrumb-item:hover { color: var(--ink); }
.breadcrumb-item.active { color: var(--ink); font-weight: 500; }
.breadcrumb-sep { color: var(--muted); }

.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 10px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
  gap: 8px;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-toggle { border-color: transparent !important; }
.view-toggle.active {
  background: var(--panel-dark) !important;
  border-color: var(--line-soft) !important;
}

.sort-select-wrap { position: relative; }
.sort-select {
  padding: 4px 8px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  appearance: none;
  padding-right: 20px;
}

/* Drop overlay */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.04);
  border: 2px dashed var(--line-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.drop-overlay.active { opacity: 1; pointer-events: all; }
.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.drop-overlay-inner span {
  font-size: 13px;
  font-family: var(--font-mono);
}

/* Items grid */
.items-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, 120px);
  gap: 16px;
  align-content: start;
}
.items-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  padding: 60px 20px;
}
.empty-title {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}
.empty-sub {
  font-size: 12px;
  margin: 0;
  text-align: center;
}

/* ══════════════════════════════════════════════════════
   FOLDER CARD (GRID VIEW)
══════════════════════════════════════════════════════ */
.folder-card {
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 10px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background var(--trans), border-color var(--trans);
  position: relative;
  user-select: none;
}
.folder-card:hover { background: var(--panel); border-color: var(--line-soft); }
.folder-card.selected { background: var(--panel); border-color: var(--accent); }

.folder-icon {
  position: relative;
  width: 72px;
  height: 60px;
  flex-shrink: 0;
}
.folder-tab {
  position: absolute;
  top: 0; left: 0;
  width: 36px; height: 10px;
  border-radius: 3px 3px 0 0;
  background: var(--folder-color, #f5c842);
  filter: brightness(0.85);
}
.folder-body {
  position: absolute;
  top: 8px; left: 0;
  width: 72px; height: 52px;
  border-radius: 0 4px 4px 4px;
  background: var(--folder-color, #f5c842);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: filter var(--trans);
}
.folder-card:hover .folder-body { filter: brightness(0.95); }

.folder-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Empty state indicator on folder */
.folder-empty-dot {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.5);
}

/* Star badge */
.folder-star {
  position: absolute;
  top: 4px; right: 4px;
  color: #f5c842;
  opacity: 0;
  font-size: 11px;
  transition: opacity var(--trans);
}
.folder-card:hover .folder-star,
.folder-card.starred .folder-star { opacity: 1; }
.folder-card.starred .folder-star { color: #f59e0b; }

.folder-name {
  font-size: 11px;
  color: var(--ink);
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.folder-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════════════
   FILE CARD (GRID VIEW)
══════════════════════════════════════════════════════ */
.file-card {
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 10px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background var(--trans), border-color var(--trans);
  position: relative;
  user-select: none;
}
.file-card:hover { background: var(--panel); border-color: var(--line-soft); }
.file-card.selected { background: var(--panel); border-color: var(--accent); }

.file-thumb {
  width: 72px; height: 60px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .file-type-icon { color: var(--muted); }

.file-name {
  font-size: 11px;
  color: var(--ink);
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-size {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}

/* ══════════════════════════════════════════════════════
   LIST VIEW ROWS
══════════════════════════════════════════════════════ */
.list-header {
  display: grid;
  grid-template-columns: 32px 1fr 120px 100px 80px 40px;
  padding: 6px 20px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.list-row {
  display: grid;
  grid-template-columns: 32px 1fr 120px 100px 80px 40px;
  align-items: center;
  padding: 7px 20px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background var(--trans);
  gap: 0;
}
.list-row:hover { background: var(--panel); }
.list-row.selected { background: var(--panel-dark); }
.list-row-icon { display: flex; align-items: center; }
.list-row-name { font-size: 12px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.list-row-modified,
.list-row-size,
.list-row-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.list-row-actions { display: flex; justify-content: flex-end; opacity: 0; transition: opacity var(--trans); }
.list-row:hover .list-row-actions { opacity: 1; }

/* Mini folder icon for list view */
.folder-mini {
  width: 20px; height: 16px;
  position: relative;
  flex-shrink: 0;
}
.folder-mini-tab {
  position: absolute;
  top: 0; left: 0;
  width: 10px; height: 4px;
  border-radius: 1px 1px 0 0;
  filter: brightness(0.85);
}
.folder-mini-body {
  position: absolute;
  top: 3px; left: 0;
  width: 20px; height: 13px;
  border-radius: 0 2px 2px 2px;
}

/* ══════════════════════════════════════════════════════
   RIGHT SIDEBAR — DETAILS
══════════════════════════════════════════════════════ */
.sidebar-right {
  width: var(--sidebar-rw);
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.detail-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.03em;
}
.detail-close {
  color: var(--muted);
  padding: 4px;
  transition: color var(--trans);
}
.detail-close:hover { color: var(--ink); }

.detail-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { display: flex; flex-direction: column; gap: 8px; }
.detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-row-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.detail-row-value { font-size: 12px; color: var(--ink); }
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.detail-tag {
  padding: 2px 7px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  border-radius: 2px;
}
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.micro-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  transition: background var(--trans), color var(--trans), border-color var(--trans);
  white-space: nowrap;
  flex-shrink: 0;
}
.micro-btn:hover {
  background: linear-gradient(180deg, #1a1a1a 0%, #666 100%);
  color: #fff;
  border-color: #1a1a1a;
}
.micro-btn.accent {
  background: linear-gradient(180deg, #1a1a1a 0%, #444 100%);
  color: #fff;
  border-color: #0a0a0a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.micro-btn.accent:hover {
  background: linear-gradient(180deg, #000 0%, #333 100%);
}
.micro-btn.danger { border-color: var(--danger); }
.micro-btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.micro-btn.full-w { width: 100%; justify-content: center; }
.micro-btn.active { background: var(--ink); color: var(--bg); }

/* ══════════════════════════════════════════════════════
   INPUTS
══════════════════════════════════════════════════════ */
.prop-input {
  width: 100%;
  padding: 6px 9px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  transition: border-color var(--trans), background var(--trans);
}
.prop-input:focus {
  border-color: var(--ink);
  background: var(--bg);
}

/* ══════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal {
  background: var(--bg);
  border: 1px solid var(--line-mid);
  box-shadow: 0 8px 48px rgba(0,0,0,0.16);
  min-width: 380px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-wide { min-width: 480px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
}
.modal-close {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--trans);
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
}
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════
   SKIN PICKER
══════════════════════════════════════════════════════ */
.skin-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
}
.skin-option {
  width: 48px;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--trans);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--muted);
  position: relative;
}
.skin-option:hover { border-color: var(--line-mid); }
.skin-option.active { border-color: var(--accent); }
.skin-option .skin-folder-preview {
  width: 32px;
  height: 28px;
  position: relative;
}
.skin-folder-tab {
  position: absolute;
  top: 0; left: 0;
  width: 14px; height: 5px;
  border-radius: 1px 1px 0 0;
  filter: brightness(0.8);
}
.skin-folder-body {
  position: absolute;
  top: 4px; left: 0;
  width: 32px; height: 24px;
  border-radius: 0 2px 2px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.skin-folder-logo { width: 12px; height: 12px; object-fit: contain; }

/* Skin preview (in skin creator modal) */
.skin-preview-area {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.folder-icon-preview {
  position: relative;
  width: 90px;
  height: 76px;
}
.folder-preview-tab {
  position: absolute;
  top: 0; left: 0;
  width: 42px; height: 12px;
  border-radius: 4px 4px 0 0;
  background: #f5c842;
  filter: brightness(0.85);
}
.folder-preview-body {
  position: absolute;
  top: 10px; left: 0;
  width: 90px; height: 66px;
  border-radius: 0 5px 5px 5px;
  background: #f5c842;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.folder-preview-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* Color input */
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-swatch-input {
  width: 36px; height: 28px;
  border: 1px solid var(--line-mid);
  padding: 2px;
  cursor: pointer;
  background: var(--bg);
}
.color-hex-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* Logo upload area */
.logo-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  border: 1px dashed var(--line-mid);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--trans), color var(--trans);
  text-align: center;
}
.logo-upload-area:hover { border-color: var(--ink); color: var(--ink); }
.logo-upload-area.drag-over { border-color: var(--accent-blue); color: var(--accent-blue); }
.link-label { color: var(--accent-blue); cursor: pointer; text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   SHARE MODAL
══════════════════════════════════════════════════════ */
.share-invite-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.share-invite-row .prop-input { flex: 1; }
.share-members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.share-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.share-member-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--panel-dark);
  border: 1px solid var(--line-mid);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.share-member-email { flex: 1; font-size: 12px; color: var(--ink); }
.share-member-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.share-member-remove {
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
  transition: color var(--trans);
}
.share-member-remove:hover { color: var(--danger); }

/* ══════════════════════════════════════════════════════
   CONTEXT MENU
══════════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  min-width: 160px;
  background: var(--bg);
  border: 1px solid var(--line-mid);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 900;
  padding: 4px;
}
.ctx-item {
  display: block;
  width: 100%;
  padding: 7px 10px;
  text-align: left;
  font-size: 12px;
  color: var(--ink);
  transition: background var(--trans);
}
.ctx-item:hover { background: var(--panel-mid); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: #fef2f2; }
body.dark .ctx-item.danger:hover { background: #2d1111; }
.ctx-divider { height: 1px; background: var(--line-soft); margin: 3px 0; }

/* ══════════════════════════════════════════════════════
   PREVIEW PANEL (page-flip style)
══════════════════════════════════════════════════════ */
.preview-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0; bottom: 0;
  width: min(640px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--line-mid);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.preview-panel.open { transform: translateX(0); }

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.preview-back {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  transition: color var(--trans);
  padding: 4px 0;
}
.preview-back:hover { color: var(--ink); }
.preview-filename {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-actions { display: flex; gap: 6px; flex-shrink: 0; }

.preview-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--panel-dark);
}
.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}
.preview-doc {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}
.preview-no-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}
.preview-no-preview p { font-size: 12px; margin: 0; }

/* ══════════════════════════════════════════════════════
   SPACE COLOR SWATCHES
══════════════════════════════════════════════════════ */
.space-color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ws-color-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--trans), transform var(--trans);
}
.ws-color-swatch:hover { transform: scale(1.15); }
.ws-color-swatch.active { border-color: var(--ink); }

/* ══════════════════════════════════════════════════════
   RENAME INLINE INPUT
══════════════════════════════════════════════════════ */
.rename-input {
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 2px 5px;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--ink);
  width: 100%;
  text-align: center;
  outline: none;
}

/* ══════════════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ══════════════════════════════════════════════════════
   SKIN PICKER — names + delete
══════════════════════════════════════════════════════ */
.skin-picker { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px; background: var(--panel-dark); border: 1px solid var(--line-soft); }
.skin-option-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.skin-option {
  width: 52px; height: 44px;
  border: 2px solid transparent;
  border-radius: 3px;
  overflow: visible;
  cursor: pointer;
  transition: border-color var(--trans);
  display: flex; align-items: center; justify-content: center;
  background: var(--panel);
  color: var(--muted);
  position: relative;
}
.skin-option:hover { border-color: var(--line-mid); }
.skin-option.active { border-color: var(--accent); }
.skin-option-name {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.03em;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.skin-delete-btn {
  position: absolute;
  top: -6px; right: -6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--trans);
  z-index: 10;
  border: none;
}
.skin-option-wrap:hover .skin-delete-btn { opacity: 1; }
.skin-delete-btn:hover { background: #a12020; }

/* ── LOGO SIZE TOGGLE ── */
.size-toggle-group { display: flex; gap: 0; }
.size-toggle-btn {
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
  margin-left: -1px;
}
.size-toggle-btn:first-child { border-radius: 2px 0 0 2px; margin-left: 0; }
.size-toggle-btn:last-child { border-radius: 0 2px 2px 0; }
.size-toggle-btn:hover { color: var(--ink); }
.size-toggle-btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); z-index: 1; position: relative; }

/* ══════════════════════════════════════════════════════
   LABEL CHIP (in detail panel)
══════════════════════════════════════════════════════ */
.label-chip {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--font-mono);
}

/* ── LABEL ACTIVE STATE ── */
.label-item { cursor: pointer; }
.label-item.active { background: var(--panel-dark); color: var(--ink); font-weight: 500; }
.label-item.active .label-dot { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--label-color, var(--muted)); }

/* ── LABEL COLOR SWATCHES ── */
.label-color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.label-color-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--trans), transform var(--trans);
}
.label-color-swatch:hover { transform: scale(1.15); }
.label-color-swatch.active { border-color: var(--ink); }

/* ══════════════════════════════════════════════════════
   UPLOAD MODAL
══════════════════════════════════════════════════════ */
.upload-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border: 1px dashed var(--line-mid);
  color: var(--muted);
  transition: border-color var(--trans), color var(--trans);
  text-align: center;
  font-size: 13px;
}
.upload-drop-zone:hover,
.upload-drop-zone.drag-over { border-color: var(--ink); color: var(--ink); }

.upload-staged-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  margin-bottom: 4px;
}
.upload-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.upload-staged-list {
  border: 1px solid var(--line-soft);
  background: var(--panel-dark);
  min-height: 60px;
  max-height: 160px;
  overflow-y: auto;
}
.upload-empty-hint {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.upload-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.upload-file-row:last-child { border-bottom: none; }
.upload-file-icon { font-size: 16px; flex-shrink: 0; }
.upload-file-info { flex: 1; min-width: 0; }
.upload-file-name { font-size: 12px; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-size { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.upload-file-remove { color: var(--muted); font-size: 16px; padding: 2px 6px; transition: color var(--trans); flex-shrink: 0; }
.upload-file-remove:hover { color: var(--danger); }

.upload-organize {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════
   VIEW TOGGLE — FIXED VISIBILITY
══════════════════════════════════════════════════════ */
.view-toggle {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--muted) !important;
}
.view-toggle:hover {
  color: var(--ink) !important;
  background: var(--panel-mid) !important;
  border-color: var(--line-soft) !important;
}
.view-toggle.active {
  background: var(--panel-dark) !important;
  border-color: var(--line-mid) !important;
  color: var(--ink) !important;
}

/* ══════════════════════════════════════════════════════
   SETTINGS MODAL
══════════════════════════════════════════════════════ */
.settings-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

/* Brand suffix row */
.brand-suffix-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  background: var(--panel-dark);
  overflow: hidden;
}
.brand-suffix-prefix {
  padding: 6px 8px 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-mid);
  border-right: 1px solid var(--line-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-suffix-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding-left: 8px !important;
  font-family: var(--font-mono);
  font-size: 11px;
}
.brand-suffix-input:focus { outline: none; }

/* Two-column branding layout */
.branding-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 0;
  margin: 4px 0;
}
.branding-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.branding-col-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

/* Settings logo area */
.settings-logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line-mid);
  min-height: 56px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: border-color var(--trans), color var(--trans);
  text-align: center;
  flex-wrap: wrap;
}
.settings-logo-area:hover { border-color: var(--ink); color: var(--ink); }
.settings-logo-area.drag-over { border-color: var(--accent-blue); }

/* Manage skins row */
.settings-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 4px;
}

/* ══════════════════════════════════════════════════════
   SKINS MANAGER (skins-modal)
══════════════════════════════════════════════════════ */
.skins-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}
.skin-manager-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  background: var(--panel-dark);
  transition: background var(--trans);
}
.skin-manager-row:hover { background: var(--panel-mid); }
.skin-manager-preview {
  position: relative;
  width: 36px;
  height: 28px;
  flex-shrink: 0;
}
.skin-mgr-tab {
  position: absolute;
  top: 0; left: 0;
  width: 16px; height: 5px;
  border-radius: 1px 1px 0 0;
}
.skin-mgr-body {
  position: absolute;
  top: 4px; left: 0;
  width: 36px; height: 22px;
  border-radius: 0 2px 2px 2px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.skin-manager-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.skin-manager-name {
  font-size: 12px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skin-manager-color {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
}
.skin-manager-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   SKIN PICKER — EDIT BUTTON
══════════════════════════════════════════════════════ */
.skin-action-btn {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--trans);
  z-index: 10;
  border: none;
}
.skin-option-wrap:hover .skin-action-btn { opacity: 1; }
.skin-edit-btn {
  top: -6px; left: -6px;
  background: var(--ink);
}
.skin-edit-btn:hover { background: #333; }
.skin-delete-btn {
  top: -6px; right: -6px;
  background: var(--danger);
}
.skin-delete-btn:hover { background: #a12020; }

/* ══════════════════════════════════════════════════════
   LABEL EDIT BUTTON
══════════════════════════════════════════════════════ */
.label-item { position: relative; }
.label-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-edit-btn {
  opacity: 0;
  color: var(--muted);
  font-size: 12px;
  padding: 1px 4px;
  transition: opacity var(--trans), color var(--trans);
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.label-item:hover .label-edit-btn { opacity: 1; }
.label-edit-btn:hover { color: var(--ink); }

/* ══════════════════════════════════════════════════════
   WORKSPACE SWITCHER
══════════════════════════════════════════════════════ */
.ws-switcher {
  position: relative;
  flex-shrink: 0;
}
.ws-switcher-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: color var(--trans), background var(--trans), border-color var(--trans);
  white-space: nowrap;
  height: 28px;
}
.ws-switcher-btn:hover {
  color: var(--ink);
  background: var(--panel-mid);
  border-color: var(--line-soft);
}
.ws-switcher-btn.open {
  color: var(--ink);
  background: var(--panel-dark);
  border-color: var(--line-soft);
}
.ws-switcher-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-chevron {
  transition: transform 0.15s ease;
  flex-shrink: 0;
  color: var(--muted);
}

.ws-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 208px;
  background: var(--bg);
  border: 1px solid var(--line-mid);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 600;
}
.ws-list { padding: 4px 0; }
.ws-item {
  display: flex;
  align-items: center;
  padding: 0 8px;
  height: 30px;
  gap: 8px;
  transition: background var(--trans);
}
.ws-item:hover { background: var(--panel-mid); }

.ws-item:hover .ws-item-actions { opacity: 1; }
.ws-item-btn {
  flex: 1;
  text-align: left;
  min-width: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.ws-item-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--trans);
}
.ws-item-name.ws-item-active {
  color: var(--ink);
  font-weight: 500;
}
.ws-item-btn:hover .ws-item-name { color: var(--ink); }

.ws-item-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transition: opacity var(--trans);
  flex-shrink: 0;
}
.ws-action-btn {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 2px;
  line-height: 1;
  transition: color var(--trans), background var(--trans);
}
.ws-action-btn:hover { color: var(--ink); background: var(--panel-dark); }
.ws-delete-btn:hover { color: var(--danger) !important; background: transparent !important; }
.ws-rename-input {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 4px;
  background: var(--bg);
  border: 1px solid var(--accent);
  color: var(--ink);
  outline: none;
  width: 100%;
  min-width: 0;
  flex: 1;
}

.ws-footer {
  border-top: 1px solid var(--line-soft);
  padding: 6px 8px;
}
.ws-new-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  width: 100%;
  text-align: left;
  transition: color var(--trans);
}
.ws-new-btn:hover { color: var(--ink); }
.ws-new-input-row { padding: 2px 0; }
.ws-new-input {
  width: 100%;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--panel-dark);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  outline: none;
}
.ws-new-input:focus { border-color: var(--ink); }

/* Workspace color dot on switcher button */
.ws-switcher-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background var(--trans);
}

/* Color dot on each workspace row */
.ws-color-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: transform var(--trans), outline-color var(--trans);
  padding: 0;
  outline: 1.5px solid transparent;
  outline-offset: 1.5px;
}
.ws-color-dot:hover { transform: scale(1.3); }
.ws-color-dot.active { outline-color: var(--ink); }

/* Inline color picker row (appears below workspace item) */
.ws-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px 8px 28px;
  background: var(--panel-dark);
  border-bottom: 1px solid var(--line-soft);
}
.ws-color-swatch {
  width: 16px; height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--trans), border-color var(--trans);
  padding: 0;
}
.ws-color-swatch:hover { transform: scale(1.2); }
.ws-color-swatch.active { border-color: var(--ink); }

/* Topbar separator (between switcher and brand) */
.topbar-sep {
  width: 1px;
  height: 16px;
  background: var(--line-soft);
  flex-shrink: 0;
}
