:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #dfe5ee;
  --text: #18212f;
  --muted: #6b7788;
  --primary: #0f6fff;
  --danger: #d92d20;
  --success: #067647;
  --shadow: 0 10px 30px rgba(22, 31, 52, 0.08);
}
html[data-theme="dark"] {
  --bg: #0f141c;
  --card: #171e29;
  --line: #273245;
  --text: #edf2fb;
  --muted: #9aa7bb;
  --primary: #6ea8ff;
  --danger: #ff6b5f;
  --success: #38c793;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 70px; }
.brand { font-size: 20px; font-weight: 700; white-space: nowrap; flex: 0 0 auto; }
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex: 1 1 auto; min-width: 0; }
.site-search { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-left: auto; flex: 0 1 460px; }
.site-search input {
  width: min(360px, 100%); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); color: var(--text);
}
.top-nav { display: flex; gap: 10px; color: var(--muted); align-items: center; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.lang-toggle, .theme-toggle {
  border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.lang-toggle.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.main-content { padding: 28px 0 48px; overflow-x: clip; }
.hero, .page-header, .panel, .auth-card, .empty-state { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.hero, .page-header, .panel, .auth-card, .empty-state { padding: 24px; }
.hero h1, .page-header h1, .auth-card h1 { margin: 0 0 8px; font-size: 30px; }
.compact-header h2, .panel h2 { margin: 0; }
.hero p, .page-header p, .muted, .card-body p, .empty-state p, .gallery-subtext { color: var(--muted); margin: 0; }
.small-text { font-size: 13px; }
.page-header.split, .toolbar-inline, .header-row, .panel-header { display: flex; gap: 12px; align-items: center; }
.page-header.split, .panel-header { justify-content: space-between; }
.toolbar-inline { flex-wrap: wrap; }
.toolbar-inline.grow { justify-content: center; }
.panel { margin-top: 20px; }
.page-header + .section-block { margin-top: 20px; }
.panel h2 { margin-bottom: 16px; font-size: 20px; }
.flash-stack {
  position: fixed;
  top: 84px;
  right: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease;
}
.flash { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.flash.success { border-color: rgba(6, 118, 71, 0.35); color: var(--success); }
.flash.error { border-color: rgba(217, 45, 32, 0.35); color: var(--danger); }
.stack-form { display: grid; gap: 14px; }
.stack-form.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack-form label { display: grid; gap: 8px; }
.stack-form span { color: var(--muted); font-size: 14px; }
.stack-form input[type="text"], .stack-form input[type="password"], .stack-form input[type="file"], .stack-form select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); color: var(--text);
}
.checkbox-line { display: inline-flex !important; gap: 10px; align-items: center; }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--card); color: var(--text); cursor: pointer;
}
.btn.small { padding: 7px 10px; font-size: 13px; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card-grid.compact { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.album-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.cover-frame { aspect-ratio: 4 / 3; background: color-mix(in srgb, var(--card) 72%, #d9e3f2 28%); overflow: hidden; }
.cover-frame.small { aspect-ratio: 1.1 / 1; }
.cover-frame img { width: 100%; height: 100%; object-fit: cover; }
.cover-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.card-body { padding: 14px; }
.card-body h3 { margin: 0 0 6px; font-size: 18px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.gallery-item { position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); }
.gallery-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: color-mix(in srgb, var(--card) 72%, #d9e3f2 28%); }
.gallery-item span, .gallery-subtext { display: block; padding: 10px 12px 0; font-size: 14px; }
.gallery-subtext { padding: 0 12px 12px; }
.admin-item { padding-bottom: 12px; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.admin-item:hover { transform: translateY(-1px); }
.admin-item.selected { border-color: color-mix(in srgb, var(--primary) 55%, var(--line) 45%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.admin-item .toolbar-inline { padding: 0 10px; }
.admin-item .toolbar-inline, .admin-item .image-check { cursor: auto; }
.image-meta-box strong { display:block; overflow-wrap:anywhere; }
.image-check { position:absolute; top:10px; left:10px; background:rgba(255,255,255,0.9); padding:6px; border-radius:10px; z-index:2; }
.auth-card { width: min(420px, 100%); margin: 48px auto 0; }
.empty-state { text-align: center; padding: 36px 24px; }
.breadcrumbs { margin-bottom: 18px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.section-block + .section-block { margin-top: 24px; }
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.tree-list { display: grid; gap: 12px; }
.tree-item { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px 14px; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tree-actions { display: flex; gap: 8px; }
.tree-open .tree-item { box-shadow: none; }
.depth-1 { margin-left: 20px; }
.depth-2 { margin-left: 40px; }
.depth-3 { margin-left: 60px; }
.depth-4 { margin-left: 80px; }
.upload-progress { width: 100%; height: 12px; background: color-mix(in srgb, var(--card) 65%, #c7d3e6 35%); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.upload-progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--primary), #7db2ff); transition: width 0.2s ease; }
.upload-meta { color: var(--muted); font-size: 14px; }
.drop-zone { border: 2px dashed var(--line); border-radius: 16px; padding: 20px; text-align:center; color:var(--muted); cursor:pointer; }
.drop-zone.dragover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--card) 92%); }
.list-toolbar { margin-bottom: 14px; }
.viewer-layout { display:grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.viewer-stage { position:relative; min-height: 70vh; display:flex; align-items:center; justify-content:center; background: color-mix(in srgb, var(--card) 70%, #c7d3e6 30%); border-radius: 18px; overflow:hidden; }
.viewer-image { max-height: 78vh; width:auto; object-fit: contain; }
.viewer-arrow { position:absolute; top:50%; transform:translateY(-50%); background: rgba(18,25,38,0.55); color:#fff; padding:12px 14px; border-radius:999px; }
.viewer-arrow.left { left:16px; }
.viewer-arrow.right { right:16px; }
.meta-list { display:grid; gap: 12px; margin: 14px 0 18px; }
.meta-list div { display:grid; gap: 4px; padding-bottom:12px; border-bottom:1px solid var(--line); }
@media (max-width: 1100px) {
  .header-row { flex-direction: column; align-items: stretch; padding: 10px 0; }
  .header-tools { width: 100%; flex-direction: column; align-items: stretch; }
  .site-search { width: 100%; max-width: none; flex: 1 1 auto; }
  .site-search input { width: 100%; }
  .top-nav { justify-content: flex-end; }
  .viewer-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
  .stack-form.two-col { grid-template-columns: 1fr; }
  .page-header.split, .tree-row { flex-direction: column; align-items: flex-start; }
}

.tree-toolbar { margin-bottom: 16px; }
.tree-collapsible { gap: 10px; }
.tree-node { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; }
.tree-summary { list-style: none; cursor: pointer; padding: 12px 14px; }
.tree-summary::-webkit-details-marker { display: none; }
.tree-main { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.tree-caret { width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.18s ease; margin-left: 2px; flex: 0 0 auto; }
.tree-node[open] > .tree-summary .tree-caret { transform: rotate(45deg); }
.tree-meta-inline { display: inline-block; margin-left: 8px; }
.tree-children { padding: 0 10px 10px; display: grid; gap: 10px; }
.tree-leaf-self { background: color-mix(in srgb, var(--card) 96%, var(--primary) 4%); }
.tree-leaf, .tree-leaf-self { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tree-summary .tree-actions { margin-left: auto; }
@media (max-width: 900px) {
  .tree-meta-inline { display: block; margin: 4px 0 0; }
}

.header-actions-wrap { justify-content: flex-end; }
.category-jump { display: grid; gap: 6px; min-width: 220px; }
.category-jump select { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); color: var(--text); }
.tree-main { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.tree-thumb-wrap { flex: 0 0 auto; }
.tree-thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 72%, #d9e3f2 28%); }
.tree-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.tree-spacer { width: 14px; flex: 0 0 14px; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tree-actions { margin-left: auto; }
.tree-summary::-webkit-details-marker { display: none; }
.tree-summary { list-style: none; }
@media (max-width: 760px) {
  .header-actions-wrap { width: 100%; justify-content: stretch; }
  .category-jump { min-width: 100%; }
  .tree-row { align-items: flex-start; }
  .tree-actions { width: 100%; display: flex; justify-content: flex-end; }
}


.viewer-side h2, .meta-list span {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.viewer-side h2 {
  line-height: 1.35;
  margin: 0 0 14px;
}
.category-jump {
  min-width: 260px;
}
.category-jump select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 11px 42px 11px 14px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
@media (max-width: 760px) {
  .category-jump {
    min-width: 100%;
  }
}


.viewer-main.panel { display: grid; gap: 16px; }
.viewer-filmstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 86px;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 2px;
  scrollbar-width: thin;
  scroll-behavior: smooth;
  scroll-padding-inline: 30%;
}

.film-thumb {
  display: block;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.film-thumb img {
  width: 100%;
  height: 72px;
  object-fit: cover;
}
.film-thumb:hover { transform: translateY(-1px); }
.film-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
@media (max-width: 1100px) {
  .top-nav { justify-content: flex-end; }
}
@media (max-width: 760px) {
  .top-nav { width: 100%; justify-content: flex-end; }
  .viewer-filmstrip { grid-auto-columns: 74px; }
  .film-thumb img { height: 64px; }
}


.admin-tree-header { align-items: flex-end; gap: 16px; }
.admin-tree-toolbar { margin-top: 14px; }
.admin-category-jump { min-width: 280px; }
.admin-tree-list .tree-summary .tree-actions,
.admin-tree-list .tree-actions { flex-wrap: wrap; }
@media (max-width: 760px) {
  .admin-tree-header { align-items: stretch; }
  .admin-category-jump { min-width: 100%; }
}

.current-album {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line) 45%) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent), var(--shadow);
  background: color-mix(in srgb, var(--primary) 5%, var(--card) 95%);
}
.current-badge {
  color: var(--primary);
  font-weight: 700;
}
.tree-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: grab;
  user-select: none;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--card) 92%, var(--primary) 8%);
}
.tree-drag:active { cursor: grabbing; }
.sortable-node.dragging {
  opacity: 0.68;
}
[data-sort-container="1"].drag-target {
  background: color-mix(in srgb, var(--primary) 5%, transparent);
  border-radius: 14px;
}
.admin-tree-list .sortable-node {
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.admin-tree-list .sortable-node:hover {
  transform: translateY(-1px);
}
.admin-tree-list .tree-summary .tree-main,
.admin-tree-list .tree-row .tree-main {
  min-width: 0;
}


.admin-gallery { align-items: stretch; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-gallery.manual-sort-mode { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-item { display: flex; flex-direction: column; min-height: 100%; padding-bottom: 0; }
.admin-item img { flex: 0 0 auto; }
.admin-item .image-meta-box { flex: 1 1 auto; display: grid; align-content: start; gap: 6px; padding-bottom: 10px; }
.admin-item .image-meta-box p { margin: 0; color: var(--muted); overflow-wrap: anywhere; word-break: break-word; }
.admin-item .image-meta-box strong { line-height: 1.35; max-height: 3.2em; overflow: hidden; }
.admin-item .image-meta-box p { min-height: 2.8em; }
.image-actions { margin-top: auto; padding: 10px 10px 12px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; align-items: stretch; }
.image-actions > a, .image-actions > form { width: 100%; }
.image-actions .btn { width: 100%; min-height: 36px; }
.image-actions form { margin: 0; }
.image-sort-form { margin: 0; }
.image-sort-label { display: inline-flex; align-items: center; margin: 0; }
.image-sort-label select { border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: var(--card); color: var(--text); min-width: 170px; height: 38px; }
.panel-header .toolbar-inline { align-items: center; }
.panel-header #bulkDeleteForm { margin: 0; }
.image-drag { position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; border: 1px dashed var(--line); background: rgba(255,255,255,0.92); color: var(--muted); cursor: grab; user-select: none; font-size: inherit; line-height: normal; letter-spacing: normal; text-align: center; font-weight: inherit; }
html[data-theme="dark"] .image-drag { background: rgba(23,30,41,0.94); }
.image-drag:active { cursor: grabbing; }
#adminImageGrid .admin-item.dragging { opacity: .65; transform: scale(.985); z-index: 3; box-shadow: 0 14px 28px rgba(15, 23, 42, .22); }
#adminImageGrid .admin-item.drop-target-before,
#adminImageGrid .admin-item.drop-target-after {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent), 0 12px 22px rgba(15, 23, 42, .12);
}
#adminImageGrid .admin-item.drop-target-before::before,
#adminImageGrid .admin-item.drop-target-after::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 80%, white 20%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
#adminImageGrid .admin-item.drop-target-before::before { top: -6px; }
#adminImageGrid .admin-item.drop-target-after::after { bottom: -6px; }
#adminImageGrid.manual-sort-mode { position: relative; }
@media (max-width: 1280px) { .admin-gallery, .admin-gallery.manual-sort-mode { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 980px) { .admin-gallery, .admin-gallery.manual-sort-mode { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .admin-gallery, .admin-gallery.manual-sort-mode { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 760px) { .image-actions { grid-template-columns: 1fr; } .image-sort-label select { min-width: 100%; } }


.flash-stack {
  position: fixed;
  top: 84px;
  right: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease;
}
.flash-stack.show { opacity: 1; transform: translateY(0); }
.flash-stack.hide { opacity: 0; transform: translateY(-8px); }
.flash { box-shadow: 0 14px 36px rgba(0,0,0,.14); }

.gallery-grid.admin-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1200px) {
  .gallery-grid.admin-gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .gallery-grid.admin-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .gallery-grid.admin-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .gallery-grid.admin-gallery { grid-template-columns: 1fr; }
}


.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.protected-badge {
  background: color-mix(in srgb, var(--primary) 12%, var(--card) 88%);
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line) 72%);
  color: var(--text);
}
.album-lock-card {
  max-width: 460px;
  margin: 24px auto 0;
  text-align: center;
}
.lock-hero {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: color-mix(in srgb, var(--primary) 10%, var(--card) 90%);
  border: 1px solid var(--line);
}
.lock-album-name {
  margin: 10px 0 14px;
  font-weight: 700;
  font-size: 18px;
}
.lock-hint {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  margin: 0 0 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 94%, var(--primary) 6%);
}
.top-gap-12 { margin-top: 12px; }



.admin-top-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-top: 18px;
  margin-bottom: 18px;
}
.top-card {
  padding: 14px;
  min-width: 0;
}
.compact-top-card {
  display: grid;
  align-content: start;
  gap: 10px;
}
.top-card-head {
  margin-bottom: 0;
}
.top-card-head h2 {
  margin: 0;
  font-size: 17px;
}
.stack-form.compact {
  gap: 10px;
}
.stack-form.compact label {
  gap: 6px;
}
.stack-form.compact input[type="text"],
.stack-form.compact input[type="password"],
.stack-form.compact input[type="file"],
.stack-form.compact select {
  padding: 10px 12px;
}
.wide-btn {
  width: 100%;
}
.compact-drop-zone {
  min-height: 86px;
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compact-drop-zone-short {
  min-height: 78px;
  padding: 12px;
}
.compact-upload-meta,
.upload-panel-card .upload-meta {
  font-size: 13px;
}
.compact-upload-form {
  gap: 8px;
}
.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}
.ultra-compact-upload-card .top-card-head h2 {
  margin-bottom: 2px;
}
.compact-drop-zone-click {
  cursor: pointer;
  min-height: 74px;
  padding: 10px 12px;
  border-radius: 14px;
}
.drop-zone-copy {
  display: grid;
  gap: 4px;
  text-align: center;
  line-height: 1.35;
}
.drop-zone-copy strong {
  font-size: 14px;
}
.drop-zone-copy span {
  font-size: 12px;
  color: var(--muted);
}
.compact-upload-meta {
  min-height: 18px;
  font-size: 12px;
}
.upload-top-card .wide-btn {
  min-height: 38px;
}
.children-panel .card-grid,
.image-manager-panel .gallery-grid {
  margin-top: 4px;
}
.image-manager-panel {
  width: 100%;
  margin-top: 20px;
}
.image-manager-panel .panel-header {
  align-items: center;
  flex-wrap: wrap;
  row-gap: 10px;
}
.image-manager-panel .toolbar-inline {
  margin-left: auto;
}
.image-manager-panel .gallery-grid {
  margin-top: 10px;
}
.top-gap-20 {
  margin-top: 20px;
}
@media (max-width: 1240px) {
  .admin-top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .admin-top-grid {
    grid-template-columns: 1fr;
  }
  .top-card {
    padding: 16px;
  }
}

/* v4.7 compact password panel */
.compact-password-card {
  padding: 16px 18px;
}
.compact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.mini-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 97%, var(--primary) 3%);
  white-space: nowrap;
}
.mini-status-pill.protected {
  color: #8fc0ff;
  border-color: color-mix(in srgb, var(--primary) 44%, var(--line) 56%);
  background: color-mix(in srgb, var(--primary) 10%, var(--card) 90%);
}
.compact-mode-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.mode-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 98%, var(--primary) 2%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.mode-tag.active {
  color: #eaf2ff;
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line) 55%);
  background: color-mix(in srgb, var(--primary) 18%, var(--card) 82%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent 80%);
}
.compact-password-form {
  gap: 10px;
}
.compact-password-form label {
  gap: 6px;
}
.compact-password-form .action-row {
  margin-top: 2px;
}
.password-actions-row {
  flex-wrap: nowrap;
}
.password-actions-row .btn {
  min-height: 42px;
}
.password-actions-row .inline-form {
  flex: 0 0 110px;
}
.password-actions-row .flex-grow {
  flex: 1 1 auto;
}
@media (max-width: 720px) {
  .compact-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .password-actions-row {
    flex-wrap: wrap;
  }
  .password-actions-row .inline-form {
    flex: 1 1 100%;
  }
}


.single-line-actions {
  margin-top: 0;
}
.password-top-card .btn,
.upload-top-card .btn {
  min-height: 38px;
}
.password-top-card .top-gap-12 {
  margin-top: 8px;
}

/* v4.9 tighter top row */
.compact-top-card .mode-tag {
  padding: 6px 10px;
  font-size: 12px;
}
.compact-top-card .mini-status-pill {
  padding: 5px 10px;
  font-size: 12px;
}
.compact-top-card .action-row {
  gap: 8px;
}
.compact-top-card .btn.wide-btn {
  min-height: 38px;
}
@media (max-width: 1240px) {
  .admin-top-grid {
    gap: 14px;
  }
}

/* v5.0 align password/upload/subalbum actions */
.password-input-only {
  margin-top: 0;
}
.password-input-only input {
  margin-top: 0;
}
.compact-password-form.password-input-only,
.compact-password-form .password-input-only {
  gap: 0;
}
.password-top-card .single-line-actions {
  margin-top: -2px;
}
.password-top-card .btn.wide-btn,
.upload-top-card .btn.wide-btn,
.top-card .btn.primary.wide-btn {
  min-height: 38px;
}
.password-top-card .compact-password-form {
  gap: 8px;
}
.password-top-card .stack-form.compact label.password-input-only {
  gap: 0;
}


/* v5.1 unified top-card button baseline */
.admin-top-grid { align-items: stretch; }
.top-card { display:flex; flex-direction:column; }
.top-card-form { display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }
.top-card-form > label, .top-card-form > .drop-zone, .top-card-form > .upload-progress, .top-card-form > .upload-meta, .top-card-form > .compact-mode-tags, .top-card-form > .compact-clear-wrap { flex:0 0 auto; }
.top-card-footer { margin-top:auto; padding-top:8px; }
.top-card .wide-btn { min-height:40px; }
.top-card-head { min-height:24px; }
.compact-top-card { gap:8px; }
.compact-clear-wrap { margin-top:8px; }
.compact-clear-wrap .btn.wide-btn { min-height:36px; }
.password-top-card .compact-mode-tags { margin-bottom:8px; }
.password-top-card .compact-password-form { flex:1 1 auto; }
.password-top-card .top-card-footer { padding-top:10px; }
.upload-top-card .compact-upload-meta { min-height:16px; }
.upload-top-card .top-card-footer { padding-top:10px; }
@media (max-width: 1240px) { .top-card-footer { margin-top:10px; } }


/* v5.2 align password main button with other top-row buttons */
.password-top-card .compact-head {
  align-items: flex-start;
}
.compact-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.head-inline-form {
  margin: 0;
}
.mini-ghost-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
}
.mini-ghost-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line) 72%);
  color: var(--text);
  background: color-mix(in srgb, var(--card) 92%, var(--primary) 8%);
}
.password-top-card .compact-password-form {
  flex: 1 1 auto;
}
.password-top-card .top-card-footer {
  margin-top: auto;
}
@media (max-width: 900px) {
  .compact-head-actions {
    justify-content: flex-start;
  }
}


/* v5.3 children album hover match image-card feel */
.children-panel .album-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 22%, var(--line) 78%);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.admin-child-grid { position: relative; }
.admin-child-card {
  position: relative;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.child-drag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,0.92);
  color: var(--muted);
  cursor: grab;
  user-select: none;
}
html[data-theme="dark"] .child-drag { background: rgba(23,30,41,0.94); }
.child-drag:active { cursor: grabbing; }
.admin-child-card.dragging { opacity: .68; transform: scale(.985); z-index: 3; box-shadow: 0 14px 28px rgba(15, 23, 42, .22); }
.admin-child-grid .admin-child-card.drop-target-before,
.admin-child-grid .admin-child-card.drop-target-after {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent), 0 12px 22px rgba(15, 23, 42, .12);
}
.admin-child-grid .admin-child-card.drop-target-before::before,
.admin-child-grid .admin-child-card.drop-target-after::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 80%, white 20%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
.admin-child-grid .admin-child-card.drop-target-before::before { top: -6px; }
.admin-child-grid .admin-child-card.drop-target-after::after { bottom: -6px; }
.album-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}
.album-card-actions .btn { width: 100%; }

.pagination-bar {
  display: flex;
  width: 100%;
  max-width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.pagination-meta {
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-actions-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.per-page-form {
  margin: 0;
}

.per-page-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.92rem;
}

.per-page-inline select {
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 5px 28px 5px 10px;
  font: inherit;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-pill {
  min-width: 72px;
  text-align: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pagination-divider {
  opacity: 0.55;
}

html, body {
  overflow-x: clip;
}

.main-content {
  padding-bottom: 84px;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 36px;
  padding: 18px 0 28px;
  color: var(--muted);
}

.footer-row {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
  cursor: pointer;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease, background .18s ease;
  backdrop-filter: blur(10px);
}

.back-to-top:hover {
  transform: translateY(4px);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#image-management, #subalbums-section, #image-management-heading, #subalbums-heading { scroll-margin-top: 96px; }

/* v5.6.10 precise drag handle centering */
.child-drag,
.image-drag {
  font-size: 0 !important;
  line-height: 0 !important;
  letter-spacing: 0 !important;
  text-indent: -9999px;
  overflow: hidden !important;
  position: absolute;
}

.child-drag::before,
.image-drag::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 16px;
  transform: translate(-50%, -50%);
  background-image:
    radial-gradient(circle, currentColor 1.2px, transparent 1.3px),
    radial-gradient(circle, currentColor 1.2px, transparent 1.3px);
  background-size: 4px 6px, 4px 6px;
  background-position: 0 0, 6px 0;
  background-repeat: repeat-y;
  opacity: .98;
  pointer-events: none;
}


/* v5.6.12 robust pointer drag */
.drag-floating { position: fixed !important; margin: 0 !important; transform: none !important; box-shadow: 0 18px 36px rgba(15,23,42,.28) !important; opacity: .96 !important; }
.drag-placeholder { visibility: visible !important; opacity: .18; border: 2px dashed color-mix(in srgb, var(--primary) 50%, transparent); background: color-mix(in srgb, var(--primary) 10%, transparent); box-shadow: none !important; }
.drag-placeholder * { visibility: hidden; }
#adminImageGrid .admin-item.dragging, .admin-child-grid .admin-child-card.dragging { opacity: .96; }
.image-drag, .child-drag { touch-action: none; cursor: grab; }
.image-drag:active, .child-drag:active { cursor: grabbing; }

/* v5.6.12.1 drag card height fix */
.drag-floating.admin-item, .drag-placeholder.admin-item { min-height: 0 !important; }
.drag-floating.admin-child-card, .drag-placeholder.admin-child-card { min-height: 0 !important; }
.drag-placeholder.admin-item, .drag-placeholder.admin-child-card { overflow: hidden; }
