.gallery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.gallery-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.gallery-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 14px;
  outline: none;
  width: 240px;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }

/* ── Tabs ── */

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.trash-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 6px;
}

/* ── Grid ── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.gallery-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.gallery-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.gallery-item-footer {
  padding: 8px 10px;
}

.gallery-item-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.gallery-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.gallery-item-clicks {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 6px;
}

.delete-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--danger);
  font-size: 11px;
  padding: 4px 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.delete-btn:hover {
  background: rgba(224, 82, 82, 0.08);
  border-color: var(--danger);
}

/* ── Department sections ── */

.dept-section {
  margin-bottom: 40px;
}

.dept-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Empty / loading ── */

.gallery-loading,
.gallery-empty {
  color: var(--text-muted);
  font-size: 15px;
  padding: 48px 0;
  text-align: center;
  grid-column: 1 / -1;
}

/* ── Lightbox ── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close:hover { color: var(--text); }

#lightbox-img {
  max-width: 70vw;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.lightbox-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lightbox-footer #lightbox-filename {
  font-size: 14px;
  font-weight: 500;
}

.lightbox-footer #lightbox-meta {
  font-size: 12px;
  color: var(--text-muted);
}

#lightbox-url {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
}
