/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.07), 0 10px 24px -4px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --logo-a: #3b82f6;
  --logo-b: #2563eb;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 15px; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: #070b18 url('bg.jpg') center / cover fixed no-repeat;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--bg-veil, linear-gradient(180deg, rgba(7, 11, 24, 0.35), rgba(7, 11, 24, 0.55)));
  z-index: 0;
}
.app { position: relative; z-index: 1; width: 100%; max-width: 100%; min-width: 0; }

/* ========== Top Bar ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 28px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 30px rgba(2, 6, 23, 0.18);
  backdrop-filter: blur(16px);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--logo-a), var(--logo-b));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-mark svg { width: 18px; height: 18px; }

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: #f3f4f6;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.user-chip:hover { background: #e5e7eb; }
.user-chip .chevron { opacity: 0.6; flex-shrink: 0; }

.topbar-right { position: relative; }

.profile-flyout {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  z-index: 1000;
}
.profile-flyout .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.profile-flyout .check-row:hover { background: #f9fafb; }
.profile-flyout .check-row input { margin: 0; }
.flyout-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  font-size: 0.85rem;
}
.flyout-field span {
  width: 52px;
  flex-shrink: 0;
  font-weight: 500;
  color: #4b5563;
}
.flyout-field input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
}
.flyout-photo {
  width: 48px;
  height: 48px;
  margin: 4px 14px 8px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
}
.flyout-photo img { width: 100%; height: 100%; object-fit: cover; }
.flyout-photo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 8px;
}
.flyout-photo-actions input[type="file"] { font-size: 0.75rem; max-width: 140px; }
.flyout-label {
  display: block;
  padding: 6px 14px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.profile-flyout .check-row.radio { padding-top: 4px; padding-bottom: 4px; }
.flyout-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.flyout-item:hover { background: #f9fafb; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ========== Buttons ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 1px 2px rgba(37,99,235,0.3);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: #f3f4f6; border-color: #9ca3af; }

.btn-danger {
  padding: 8px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #fee2e2; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: #f3f4f6;
  color: var(--text);
}

/* ========== Main ========== */
.main {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 28px 60px;
  min-width: 0;
  box-sizing: border-box;
}

.page-intro {
  margin-bottom: 24px;
}
.page-intro h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  color: #f8fafc;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.page-intro p {
  color: rgba(226, 232, 240, 0.86);
  font-size: 0.925rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  min-width: 0;
}
.search-wrap {
  position: relative;
  flex: 0 1 320px;
  min-width: 180px;
}
.desktop-bar {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.desktop-tab, .desktop-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(15, 23, 42, 0.35);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.desktop-tab .desktop-chevron {
  opacity: 0.7;
  flex-shrink: 0;
}
.desktop-tab:hover .desktop-chevron,
.desktop-tab.active .desktop-chevron { opacity: 1; }
.desktop-tab.active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}
.desktop-add {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(15, 23, 42, 0.35);
  color: #e2e8f0;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.desktop-add:hover { background: #fff; color: var(--primary); }
#desktopMenu {
  position: fixed;
  z-index: 80;
  right: auto;
  width: max-content;
  min-width: 160px;
}
.actions-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: auto;
  min-width: 160px;
  width: max-content;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.actions-panel[hidden] { display: none; }
.actions-panel button {
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.actions-panel button:hover { background: #f3f4f6; }
.count-pill { flex-shrink: 0; }
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: #64748b;
}
#searchInput {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-sm);
}
#searchInput:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }
.count-pill {
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

/* ========== App Grid ========== */
.app-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  /* Equal columns, at least 350px (~25% wider), wrapping 4 → 3 → 2 → 1 */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: 18px;
}

@media (max-width: 540px) {
  .topbar { padding: 0 16px; }
  .main { padding: 20px 16px 40px; }
  .user-chip span { display: none; }
}

/* ========== App Card ========== */
.app-card {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.22);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
  cursor: default;
  user-select: none;
}

.app-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #c7d2fe;
  transform: translateY(-1px);
}

.app-card.sortable-ghost {
  opacity: 0.35;
  background: #e0e7ff;
}

.app-card.sortable-chosen {
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
}

/* Drag handle */
.drag-handle {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 20px;
  height: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  opacity: 0.25;
  cursor: grab;
  padding: 2px;
}
.drag-handle span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}
.app-card:hover .drag-handle { opacity: 0.55; }

/* Card header: icon + name + edit */
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-left: 14px; /* room for drag handle */
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 1.15rem;
}
.card-icon svg { width: 22px; height: 22px; }

.card-title-block {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
  cursor: pointer;
  border-radius: 8px;
}
.card-title-block:hover .card-title { color: var(--primary); }

.card-title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 0.78rem;
  color: #1f2937;
  font-weight: 500;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-edit {
  flex-shrink: 0;
  margin-top: -2px;
  margin-right: -4px;
}

/* URL rows */
.url-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 6px 8px 6px 10px;
  min-height: 36px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.url-row.local { background: #f0f7ff; border-color: #dbeafe; }
.url-row.remote { background: #f0fdf4; border-color: #dcfce7; }

.url-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  width: 48px;
  flex-shrink: 0;
}

.url-row.local .url-label { color: #3b82f6; }
.url-row.remote .url-label { color: #10b981; }

.url-value {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0;
}
.url-value:hover { text-decoration: underline; color: var(--primary); }
.url-value:disabled { cursor: default; text-decoration: none; color: var(--text-muted); }

.url-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.url-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.url-actions button:hover {
  background: white;
  color: var(--primary);
  border-color: #93c5fd;
  box-shadow: var(--shadow-sm);
}
.url-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-muted);
}
.url-actions button svg { width: 14px; height: 14px; }

/* Open Folder button */
.btn-folder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #94a3b8;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  color: #303030; /* #1d4ed8; */
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-folder:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1e3a8a;
}
.btn-folder:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--text-muted);
}
.btn-folder:disabled:hover {
  background: transparent;
  border-color: var(--border);
}
.btn-folder svg { width: 15px; height: 15px; }

/* ========== Drawer ========== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}
.drawer-overlay[hidden] { display: none; }

.drawer {
  width: min(420px, 100%);
  height: 100%;
  background: var(--surface);
  box-shadow: -12px 0 40px rgba(0,0,0,0.12);
  padding: 0;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.22s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h2 {
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.drawer-form {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer-actions {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  z-index: 2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field > span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.field small { font-weight: 400; color: var(--text-muted); }

.field input[type="text"],
.field input[type="url"],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.field textarea { resize: vertical; min-height: 64px; }

.icon-picker {
  display: grid;
  grid-template-columns: repeat(5, 42px);
  gap: 8px;
}
.icon-choice {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: #e5e7eb;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.icon-choice svg { width: 22px; height: 22px; }
.icon-choice:hover { border-color: #cbd5e1; }
.icon-choice.selected {
  color: #fff;
  border-color: #0f172a;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0f172a;
}
.field input[type="color"] {
  height: 40px;
  padding: 3px;
  cursor: pointer;
  border-radius: 8px;
}

.edit-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 8px 0 0;
}
.edit-meta p { margin: 2px 0; }

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.drawer-actions .spacer { flex: 1; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
}
.toast[hidden] { display: none; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  color: var(--text-secondary);
}
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }
.empty-state p { margin-bottom: 20px; color: var(--text-secondary); }
.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.drop-zone {
  margin: 0 auto 16px;
  max-width: 420px;
  padding: 22px 16px;
  border: 1.5px dashed #94a3b8;
  border-radius: 12px;
  color: #334155;
  font-weight: 600;
  background: rgba(248, 250, 252, 0.8);
}
.drop-zone.dragover { border-color: var(--primary); background: #eff6ff; }
.import-choice {
  margin: auto;
  width: min(420px, calc(100% - 32px));
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}
.import-choice h2 { font-size: 1.15rem; margin-bottom: 6px; }
.import-choice p { color: var(--text-secondary); margin-bottom: 16px; }
.import-choice-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.profile-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  padding: 4px 0;
  cursor: pointer;
}
.check-row.nested { margin-left: 22px; }
.field-note {
  margin: 8px 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #6b7280;
}
.field-note.warn {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
}
.color-row { gap: 10px; }
.color-row input[type="color"] { width: 42px; height: 28px; padding: 0; border: none; background: transparent; }
.color-row output { min-width: 36px; font-variant-numeric: tabular-nums; }
.file-row { display: flex; align-items: center; gap: 8px; }
.file-row input[type="text"] { flex: 1; min-width: 0; }
.file-row input[type="file"] { font-size: 0.8rem; max-width: 220px; }
.photo-preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  margin-top: 8px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.theme-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.theme-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.theme-swatch.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.theme-swatch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-delete {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
}
.custom-theme {
  display: grid;
  grid-template-columns: 1fr 72px auto;
  gap: 8px;
  align-items: end;
}
.custom-color input { width: 100%; height: 38px; }
