/* ══════════════════════════════════════════
   images.epikore — app.css
   Aesthetic: claude.ai inspired
══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f5f3ee;
  --surface:      #faf9f6;
  --surface2:     #f0ede6;
  --surface3:     #e8e4db;
  --border:       rgba(0,0,0,0.08);
  --border-med:   rgba(0,0,0,0.13);
  --border-strong:rgba(0,0,0,0.18);
  --accent:       #d4713a;
  --accent-hover: #c4612a;
  --accent-dim:   rgba(212,113,58,0.1);
  --text:         #1a1915;
  --text-sec:     #5c5a54;
  --text-muted:   #96948d;
  --danger:       #c0392b;
  --danger-dim:   rgba(192,57,43,0.09);
  --success:      #2d7a4e;
  --warning:      #9a6b00;
  --sidebar-w:    236px;
  --topbar-h:     54px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Söhne', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ──────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.main {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

/* ── SIDEBAR ────────────────────────────── */

.sidebar-header {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.logo-dot {
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.logo-dot::after {
  content: '';
  width: 7px; height: 7px;
  background: #fff;
  border-radius: 50%;
}

.logo-dim { color: var(--text-muted); font-weight: 400; }

.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.13s, border-color 0.13s, background 0.13s;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-med); background: var(--surface2); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 4px; }

.nav-special { margin-bottom: 2px; }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 400;
  padding: 7px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: 0.6; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.nav-item.active svg { opacity: 1; }

.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 1px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}
.nav-item.active .nav-count { background: var(--accent-dim); color: var(--accent); }

.nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 9px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.add-cat-btn {
  background: none;
  border: 1px solid var(--border-med);
  border-radius: 5px;
  color: var(--text-muted);
  width: 20px; height: 20px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.add-cat-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border-strong); }

/* Category folder items */
.cat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 13.5px;
  padding: 6px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.1s, color 0.1s, border-color 0.12s;
  position: relative;
  user-select: none;
}
.cat-item .drag-handle {
  cursor: grab;
  color: var(--border-strong);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s;
}
.cat-item:hover .drag-handle { opacity: 1; }
.cat-item:hover { background: var(--surface2); color: var(--text); }
.cat-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.cat-item.drop-target {
  border-color: var(--accent) !important;
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
}

.cat-folder-icon {
  flex-shrink: 0;
  color: var(--warning);
}

.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-count {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 1px 6px;
  border-radius: 20px;
  flex-shrink: 0;
}
.cat-item.active .cat-count { background: var(--accent-dim); color: var(--accent); }

.cat-actions {
  display: flex;
  gap: 2px;
  margin-left: 2px;
  opacity: 0;
  transition: opacity 0.1s;
}
.cat-item:hover .cat-actions { opacity: 1; }
.cat-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 18px; height: 18px;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  padding: 0;
  transition: color 0.1s, background 0.1s;
}
.cat-action-btn:hover { color: var(--text); background: var(--surface3); }
.cat-action-btn.del:hover { color: var(--danger); }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-user { font-size: 12px; color: var(--text-muted); }
.logout-btn {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.12s;
}
.logout-btn:hover { color: var(--danger); }

/* ── TOPBAR ──────────────────────────────── */

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 10px; }

.view-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.image-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── BUTTONS ─────────────────────────────── */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.13s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-sec);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--border-strong); color: var(--text); }
.btn-secondary.sm { padding: 5px 11px; font-size: 12px; }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(192,57,43,0.18);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.13s;
}
.btn-danger:hover { background: rgba(192,57,43,0.15); }

.btn-copy {
  background: var(--surface2);
  border: 1px solid var(--border-med);
  color: var(--text-muted);
  border-radius: var(--radius);
  width: 34px; height: 34px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.13s;
  flex-shrink: 0;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.btn-copy.copied { color: var(--success); border-color: var(--success); }

/* ── DROP OVERLAY ────────────────────────── */

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245,243,238,0.92);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  margin: 8px;
  pointer-events: none;
}
.drop-overlay.visible { display: flex; }
.drop-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}
.drop-message p {
  font-size: 17px;
  font-weight: 500;
}

/* ── IMAGE GRID ──────────────────────────── */

.grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}
.grid-wrap::-webkit-scrollbar { width: 6px; }
.grid-wrap::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 4px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 10px;
}

.image-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.13s, transform 0.15s, box-shadow 0.15s;
  position: relative;
  aspect-ratio: 1;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.image-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.image-card.sortable-ghost {
  opacity: 0.3;
  border: 2px dashed var(--accent);
}
.image-card.sortable-chosen {
  box-shadow: 0 12px 28px rgba(0,0,0,0.14);
  z-index: 999;
}

.image-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}

.image-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.13s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 9px;
  gap: 4px;
  pointer-events: none;
}
.image-card:hover .image-card-overlay { opacity: 1; }

.image-card-name {
  font-size: 11px;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.image-card-actions { display: flex; gap: 4px; }

.card-action-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 5px;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
  backdrop-filter: blur(6px);
  pointer-events: all;
}
.card-action-btn:hover { background: rgba(255,255,255,0.25); }
.card-action-btn.del:hover { background: rgba(192,57,43,0.55); }

.disabled-badge {
  position: absolute;
  top: 7px; left: 7px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(192,57,43,0.3);
  color: var(--danger);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.image-card.disabled img { opacity: 0.45; }

.unassign-btn {
  position: absolute;
  top: 7px; right: 7px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 4px;
  color: var(--text-sec);
  font-size: 10px;
  font-family: inherit;
  padding: 2px 7px;
  cursor: pointer;
  display: none;
  backdrop-filter: blur(4px);
  transition: all 0.1s;
}
.image-card:hover .unassign-btn { display: block; }
.unassign-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ── EMPTY STATE ─────────────────────────── */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-muted);
  gap: 10px;
  text-align: center;
}
.empty-state p { font-size: 15px; color: var(--text-sec); font-weight: 500; }
.empty-state span { font-size: 13px; }

/* ── MODALS ──────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,25,21,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.13s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.08);
  animation: slideUp 0.18s ease;
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  transition: color 0.1s, background 0.1s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 4px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ── UPLOAD MODAL ────────────────────────── */

.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  transition: border-color 0.13s, background 0.13s;
  text-align: center;
  background: var(--bg);
}
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
.upload-zone svg { opacity: 0.45; }
.upload-zone p { font-size: 14px; font-weight: 500; color: var(--text-sec); }
.upload-zone span { font-size: 12px; }

.upload-file-btn {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  color: var(--text-sec);
  font-size: 13px;
  font-family: inherit;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.1s;
  margin-top: 4px;
}
.upload-file-btn:hover { background: var(--surface2); border-color: var(--border-strong); color: var(--text); }

.upload-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.upload-divider::before, .upload-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.url-import { display: flex; gap: 8px; }
.url-import input { flex: 1; }

.upload-queue {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 11px;
  font-size: 13px;
}
.upload-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-sec); }
.upload-item-status {
  font-size: 11.5px;
  flex-shrink: 0;
}
.upload-item-status.uploading { color: var(--accent); }
.upload-item-status.done { color: var(--success); }
.upload-item-status.error { color: var(--danger); }

/* ── IMAGE DETAIL MODAL ───────────────────── */

.image-modal-body {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 0;
  padding: 0;
}

.image-modal-preview {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 280px;
  border-right: 1px solid var(--border);
}
.image-modal-preview img {
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.image-modal-meta {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.meta-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.url-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.url-row input { flex: 1; min-width: 0; }

.slug-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  display: block;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid var(--border-med);
  transition: background 0.18s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.18s, background 0.18s;
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); background: #fff; }
.toggle-label { font-size: 13px; color: var(--text-sec); }

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
}
.cat-chip {
  background: var(--surface2);
  border: 1px solid var(--border-med);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--text-sec);
  padding: 3px 9px 3px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cat-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: flex; align-items: center;
}
.cat-chip-remove:hover { color: var(--danger); }

.cat-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.13s;
}
.cat-select:focus { border-color: var(--accent); }

.meta-info {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.meta-row span:first-child { color: var(--text-muted); }
.meta-row span:last-child { color: var(--text-sec); font-size: 11.5px; }

.image-modal-actions { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── FORM ELEMENTS ───────────────────────── */

input[type=text],
input[type=url],
input[type=password],
input[type=number],
select {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 11px;
  outline: none;
  transition: border-color 0.13s, box-shadow 0.13s;
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder { color: var(--text-muted); }
input[readonly] { cursor: default; background: var(--bg); }

input[type=range] {
  width: 100%;
  padding: 0;
  accent-color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 13px;
}
.form-group label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── SETTINGS ────────────────────────────── */

.settings-body { padding: 0; }
.settings-section {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }
.settings-section h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.settings-msg {
  font-size: 12px;
  margin-top: 7px;
  min-height: 16px;
}
.settings-msg.ok { color: var(--success); }
.settings-msg.err { color: var(--danger); }

/* ── TOAST ───────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9999;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-sec);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.18s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  max-width: 300px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toast.success .toast-dot { background: var(--success); }
.toast.error   .toast-dot { background: var(--danger); }
.toast.info    .toast-dot { background: var(--accent); }

@keyframes toastIn {
  from { transform: translateX(16px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(16px); opacity: 0; }
}
.toast.out { animation: toastOut 0.18s ease forwards; }

/* ── SORTABLE ────────────────────────────── */
.sortable-ghost { opacity: 0.25; }
.sortable-drag  { opacity: 1 !important; }
/* ── TOPBAR BUTTONS ──────────────────────── */

.topbar-right {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

/* ── BULK / SELECT MODE ──────────────────── */

.bulk-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  animation: slideDown 0.15s ease;
}
@keyframes slideDown {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.bulk-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bulk-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulk-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-sec);
  user-select: none;
}

.bulk-select-all input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-med);
  border-radius: 4px;
  background: var(--surface);
  appearance: auto;
}

/* Card checkbox */
.card-checkbox-wrap {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 5;
  display: none;
  pointer-events: all;
}

.select-mode .card-checkbox-wrap {
  display: block;
}

.card-checkbox {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  border-radius: 4px;
  margin: 0;
  appearance: auto;
}

.image-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.select-mode .image-card {
  cursor: default;
}

.select-mode .image-card img {
  pointer-events: none;
}

.btn-secondary.sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-danger.sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ══════════════════════════════════════════
   MOBILE RESPONSIVE
══════════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border-med);
  border-radius: var(--radius);
  color: var(--text-sec);
  cursor: pointer;
  width: 34px; height: 34px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}
.hamburger:hover { background: var(--surface2); }

/* Sidebar overlay backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,25,21,0.4);
  z-index: 9;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.visible { display: block; }

@media (max-width: 700px) {

  /* Show hamburger */
  .hamburger { display: flex; }

  /* Sidebar slides in from left as overlay */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 20;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Main takes full width */
  .main {
    margin-left: 0;
  }

  /* Topbar adjustments */
  .topbar {
    padding: 0 14px;
    gap: 8px;
  }
  .topbar-left {
    flex: 1;
    min-width: 0;
  }
  .view-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .image-count { display: none; }
  .topbar-right { gap: 6px; }
  .btn-primary { padding: 7px 10px; font-size: 12px; }
  .btn-secondary { padding: 7px 10px; font-size: 12px; }

  /* Bulk bar */
  .bulk-bar {
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .bulk-bar-right { gap: 5px; }
  .bulk-bar-right .btn-secondary.sm,
  .bulk-bar-right .btn-danger.sm {
    padding: 5px 9px;
    font-size: 11px;
  }

  /* Grid */
  .grid-wrap { padding: 14px; }
  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  /* Image detail modal — stack vertically, full scroll */
  .image-modal-body {
    grid-template-columns: 1fr;
    overflow-y: visible;
    max-height: unset;
  }
  .image-modal-preview {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px;
    min-height: unset;
    flex-shrink: 0;
  }
  .image-modal-preview img {
    max-height: 35vh;
  }
  .image-modal-meta {
    padding: 14px;
    overflow-y: visible; /* let parent scroll */
    flex-shrink: 0;
  }
  .image-modal-actions {
    padding-bottom: 24px; /* breathing room at bottom */
  }

  /* Modal sizing */
  .modal-overlay { padding: 10px; align-items: flex-start; padding-top: 20px; }
  .modal { max-height: 95vh; }
  .modal.modal-image { max-width: 100% !important; overflow-y: auto; }
  .modal.modal-image .modal-body { overflow: visible; padding: 0; }

  /* Upload zone */
  .upload-zone { padding: 24px 16px; }

  /* Settings sections */
  .settings-section { padding: 14px; }
}

@media (max-width: 400px) {
  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
  }
  .grid-wrap { padding: 10px; }
}

/* Mobile close button on image modal */
@media (max-width: 700px) {
  .modal-close {
    width: 34px;
    height: 34px;
    font-size: 22px;
    border: 1px solid var(--border-med);
    background: var(--surface2);
  }
  .modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
  }
}