/* Shared visual language for the admin dashboard and delivery editor. */
body.admin-body {
  --admin-ink: #24221e;
  --admin-muted: #77736b;
  --admin-paper: #f4f1eb;
  --admin-card: #fffdf9;
  --admin-gold: #c6a45c;
  background: var(--admin-paper) !important;
  color: var(--admin-ink) !important;
  font-family: "Cairo", Arial, sans-serif;
  min-height: 100svh;
  background-image: radial-gradient(ellipse at 72% 0%, rgba(198,164,92,.08), transparent 42%);
}

.admin-sidebar {
  background: #201f1c !important;
  border-color: rgba(255,255,255,.08) !important;
  padding: 1.5rem 1.2rem !important;
  gap: 2rem !important;
  border-inline-end: 1px solid rgba(255,255,255,.08) !important;
  border-inline-start: 0 !important;
}

.admin-sidebar .brand { font-size: 1.05rem !important; letter-spacing: 0 !important; }
.admin-sidebar .brand-mark { background: var(--admin-gold) !important; color: #201f1c !important; border-radius: 50% !important; }
.admin-preferences { display: flex; align-items: center; gap: 9px; }
.admin-sidebar > .admin-preferences { margin-top: -1.15rem; margin-bottom: -.7rem; }
.admin-preferences button { min-height: 42px; border: 1px solid rgba(198,164,92,.66); border-radius: 999px; background: transparent; color: #f0e5ca; cursor: pointer; font: 600 .82rem "Cairo", Arial, sans-serif; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.admin-preferences button:hover { background: rgba(198,164,92,.14); border-color: var(--admin-gold); }
.admin-language-toggle { min-width: 92px; padding: 0 14px; }
.admin-theme-toggle { width: 44px; display: grid; place-items: center; font-size: .95rem !important; }
.admin-sidebar nav a { border-radius: 8px !important; font-size: .9rem !important; }
.admin-sidebar nav a.active { background: rgba(198,164,92,.16) !important; color: #f1d89d !important; box-shadow: inset 3px 0 #c6a45c !important; }
.admin-sidebar nav a:hover { background: rgba(255,255,255,.08) !important; }
.admin-sidebar nav button#logoutBtn { border-width: 1px !important; border-color: rgba(255,255,255,.22) !important; color: #ddd7cd !important; }
.admin-sidebar nav button#logoutBtn:hover { background: #9c493d !important; border-color: #9c493d !important; }
.admin-sidebar > .admin-preferences { display: flex; }

.admin-main { background: var(--admin-paper) !important; padding: clamp(1rem, 3vw, 2.75rem) !important; }
.admin-top { margin-bottom: 1.6rem !important; }
.admin-top h1 { color: var(--admin-ink) !important; letter-spacing: -.04em; font-size: clamp(1.8rem, 3vw, 2.7rem) !important; line-height: 1.2; }
.admin-top .eyebrow { color: #9c7a38 !important; letter-spacing: .12em; font-size: .72rem !important; }
.admin-grid { gap: 1.2rem !important; align-items: start; grid-template-columns: minmax(290px, .78fr) minmax(0, 1.55fr) !important; }
.admin-card,
.access-code-section,
.section-panel,
.admin-main > section {
  background: var(--admin-card) !important;
  border: 1px solid #e7e1d6 !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 32px rgba(48,42,30,.045) !important;
}
.admin-card { padding: clamp(1rem, 2.3vw, 1.6rem) !important; }
.admin-card h2 { font-size: 1.04rem !important; margin-bottom: 1rem !important; padding-bottom: .8rem !important; border-color: #ece7de !important; }
.admin-card h2,
.admin-main h2,
.section-panel h2 { color: var(--admin-ink) !important; }
.admin-card h2 i,
.admin-main h2 i { color: #a88645 !important; }

.admin-body input:not([type="file"]),
.admin-body select,
.admin-body textarea {
  color: #292721 !important;
  background-color: #fff !important;
  border-color: #ded8cd !important;
  border-radius: 8px !important;
  min-height: 44px;
}
.admin-body input:focus-visible,
.admin-body select:focus-visible,
.admin-body textarea:focus-visible,
.admin-body button:focus-visible,
.admin-body a:focus-visible,
.admin-body [tabindex="0"]:focus-visible {
  outline: 3px solid rgba(179,143,69,.45) !important;
  outline-offset: 2px;
}
.admin-body label { color: #514d45; }
.admin-body .muted { color: var(--admin-muted) !important; }
.admin-body .button.primary,
.admin-body button.button.primary { background: #292722 !important; color: #fff !important; border-radius: 8px !important; }
.admin-body .button.primary:hover { background: #9a7838 !important; }
.admin-body .button.secondary,
.admin-body .btn-outline { border-radius: 8px !important; }
.admin-body input::placeholder, .admin-body textarea::placeholder { color: #8a867e !important; }

#galleriesList .gallery-row {
  border: 1px solid #e9e4da !important;
  border-radius: 10px !important;
  background: #fff !important;
  padding: 1rem !important;
  gap: .8rem !important;
  box-shadow: none !important;
}
#galleriesList .gallery-row:hover { border-color: #cbb47e !important; box-shadow: 0 8px 20px rgba(48,42,30,.06) !important; }
#galleriesList .gallery-row strong { color: var(--admin-ink) !important; }
#galleriesList .gallery-actions, #galleriesList .thumb-actions { flex-wrap: wrap; }
#galleriesList .gallery-row {
  display: grid !important;
  grid-template-columns: 92px minmax(150px, 1fr) minmax(125px, auto) auto;
  align-items: center !important;
  gap: 14px !important;
}
.gallery-cover {
  width: 92px;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(145deg, #e8dfce, #d6c39a);
  color: rgba(54,48,38,.56);
}
.gallery-cover i { font-size: 1.25rem; }
.gallery-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.gallery-identity { display: grid; min-width: 0; gap: 4px; }
.gallery-identity strong { overflow-wrap: anywhere; line-height: 1.45; }
.gallery-row-meta { display: grid; gap: 7px; color: var(--admin-muted); font-size: .78rem; }
.gallery-row-meta span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.gallery-row-meta i { color: #a88645; }
#galleriesList .thumb-actions { gap: 6px; }
#galleriesList .thumb-actions .button { min-height: 40px; }
#galleriesList .gallery-notes-row { grid-column: 1 / -1; }

.access-code-section { border-inline-start: 3px solid var(--admin-gold) !important; }
.access-code-section .code-value { background: #f5f1e8 !important; border-radius: 8px !important; }
html[data-theme="dark"] body.admin-body { --admin-ink: #f2efe9; --admin-muted: #aaa49a; --admin-paper: #141311; --admin-card: #1d1b18; color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body, html[data-theme="dark"] body.admin-body .admin-main { background-color: var(--admin-paper) !important; }
html[data-theme="dark"] body.admin-body .admin-card, html[data-theme="dark"] body.admin-body .admin-main > section, html[data-theme="dark"] body.admin-body .section-panel { background: var(--admin-card) !important; border-color: #35312a !important; }
html[data-theme="dark"] body.admin-body .admin-card h2, html[data-theme="dark"] body.admin-body .admin-main h2, html[data-theme="dark"] body.admin-body .admin-top h1 { color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body input:not([type="file"]), html[data-theme="dark"] body.admin-body select, html[data-theme="dark"] body.admin-body textarea { background: #171613 !important; border-color: #403b32 !important; color: #f2efe9 !important; }
html[data-theme="dark"] body.admin-body #galleriesList .gallery-row { background: #191815 !important; border-color: #35312a !important; }
html[data-theme="dark"] body.admin-body #galleriesList .gallery-row strong, html[data-theme="dark"] body.admin-body #galleriesList .gallery-row > div { color: #f2efe9 !important; }
html[data-theme="dark"] body.admin-body .access-code-section .code-value { background: #29251e !important; color: #f2efe9 !important; }
body.admin-body:has(.auth-shell) { position: relative; }
body.admin-body .admin-login-preferences { position: absolute; z-index: 2; top: 24px; inset-inline-end: 28px; }
body.admin-body .admin-login-preferences button { color: var(--admin-ink); border-color: var(--admin-gold); }
.dropzone { background: #faf8f3 !important; border-color: #cfc5b2 !important; border-radius: 12px !important; }
.dropzone:hover, .dropzone.is-dragging { background: #f3eee3 !important; border-color: #a88645 !important; }
.thumb-card { border-radius: 10px !important; border-color: #e7e1d6 !important; box-shadow: 0 8px 24px rgba(48,42,30,.06) !important; }
.section-block { margin-top: 1rem; }
body.admin-body .auth-shell { min-height: 100svh; padding: 2rem 1rem; }
body.admin-body .auth-card { background: var(--admin-card) !important; border: 1px solid #e7e1d6 !important; border-radius: 16px !important; box-shadow: 0 18px 48px rgba(30,27,22,.12) !important; color: var(--admin-ink); }
body.admin-body .admin-login-preferences { position: absolute; z-index: 2; top: 24px; inset-inline-end: 28px; }
body.admin-body .admin-login-preferences button { color: var(--admin-ink); border-color: var(--admin-gold); }

@media (max-width: 768px) {
  .admin-sidebar { padding: .8rem 1rem !important; gap: .65rem !important; }
  .admin-sidebar nav { background: #201f1c !important; }
  .admin-sidebar .brand { min-width: 0; }
  .admin-sidebar > .admin-preferences { margin: 0; }
  .admin-preferences button { min-height: 38px; }
  .admin-language-toggle { min-width: 76px; padding: 0 10px; }
  .admin-theme-toggle { width: 40px; }
  .admin-main { padding: 1rem !important; }
  .admin-top { margin-bottom: 1rem !important; }
  .admin-top h1 { font-size: clamp(1.35rem, 6vw, 1.8rem) !important; }
  .admin-grid { grid-template-columns: 1fr !important; }
  .admin-grid > .admin-card:nth-child(2) { grid-row: 1; }
  .admin-grid > .admin-card:nth-child(1) { grid-row: 2; }
  #galleriesList .gallery-row { grid-template-columns: 76px minmax(0, 1fr) !important; align-items: center !important; gap: 8px 12px !important; }
  .gallery-cover { grid-column: 1; grid-row: 1 / span 2; width: 76px; }
  .gallery-identity { grid-column: 2; grid-row: 1; }
  .gallery-row-meta { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: 6px 14px; }
  #galleriesList .thumb-actions { grid-column: 1 / -1; justify-content: flex-start !important; }
  #galleriesList .gallery-notes-row { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .admin-sidebar { display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; }
  .admin-sidebar .brand { grid-column: 1; }
  .admin-sidebar > .admin-preferences { grid-column: 2; grid-row: 1; }
  .admin-sidebar .hamburger-btn { grid-column: 3; grid-row: 1; order: initial !important; }
  .admin-sidebar nav { grid-column: 1 / -1; grid-row: 2; order: initial !important; }
  #galleriesList .gallery-row { grid-template-columns: 64px minmax(0, 1fr) !important; padding: .7rem !important; }
  body.admin-body .admin-login-preferences { top: 14px; inset-inline-end: 14px; }
}

@media (max-width: 380px) {
  #galleriesList .gallery-row { grid-template-columns: 62px minmax(0, 1fr) !important; padding: .65rem !important; gap: 7px 9px !important; }
  .gallery-cover { width: 62px; }
  #galleriesList .thumb-actions .button { min-height: 38px; padding: .35rem .55rem; font-size: .7rem; }
}

html[data-theme="dark"] body.admin-body .auth-card { background: #1d1b18 !important; border-color: #35312a !important; color: #f2efe9 !important; }
html[data-theme="dark"] body.admin-body .auth-card label { color: #e6e0d5 !important; }
html[data-theme="dark"] body.admin-body .auth-card input { background: #171613 !important; border-color: #403b32 !important; color: #f2efe9 !important; }

@media (prefers-reduced-motion: reduce) {
  .admin-body *, .admin-body *::before, .admin-body *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Editorial admin refresh inspired by Pixells' warm, gallery-first presentation. */
body.admin-body {
  --admin-ink: #26221f;
  --admin-muted: #77716a;
  --admin-paper: #f4f1eb;
  --admin-card: #fffdfa;
  --admin-gold: #c4a15c;
  --admin-clay: #805047;
  background: var(--admin-paper) !important;
  color: var(--admin-ink) !important;
  background-image: radial-gradient(ellipse at 78% 0%, rgba(196,161,92,.09), transparent 36%);
}

html:lang(en) body.admin-body { font-family: "Manrope", "Arial", sans-serif; }
html:lang(ar) body.admin-body { font-family: "Cairo", "Arial", sans-serif; }
.admin-sidebar {
  width: 248px !important;
  background: #211f1c !important;
  border-color: rgba(255,255,255,.08) !important;
  padding: 1.7rem 1.2rem !important;
  gap: 1.6rem !important;
}
.admin-sidebar .brand { font-family: Georgia, serif; font-size: 1.1rem !important; letter-spacing: .01em !important; }
.admin-sidebar .brand-mark { background: var(--admin-gold) !important; color: #211f1c !important; border-radius: 50% !important; }
.admin-sidebar nav { gap: 5px !important; }
.admin-sidebar nav a { min-height: 44px; border-radius: 8px !important; color: #d3cec6 !important; font-size: .86rem !important; }
.admin-sidebar nav a.active { background: rgba(196,161,92,.14) !important; color: #f2dfb5 !important; box-shadow: inset 3px 0 var(--admin-gold) !important; }
.admin-sidebar nav a.active i { color: var(--admin-gold); }
.admin-sidebar nav button#logoutBtn { border-color: rgba(255,255,255,.2) !important; color: #d9d4cb !important; }
.admin-sidebar nav button#logoutBtn:hover { background: #805047 !important; border-color: #805047 !important; }

.admin-main {
  width: min(100%, 1640px);
  margin-inline: auto;
  padding: clamp(1.2rem, 3vw, 3.25rem) !important;
  background: transparent !important;
}
.admin-top { align-items: center; gap: 1.25rem; margin-bottom: 2rem !important; }
.admin-top h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.05rem, 3.7vw, 3.5rem) !important;
  font-weight: 500 !important;
  letter-spacing: -.045em !important;
  line-height: 1.08 !important;
}
.admin-top .eyebrow { color: var(--admin-clay) !important; font-size: .68rem !important; font-weight: 700 !important; letter-spacing: .17em !important; margin-bottom: .5rem !important; }
.admin-top .muted { margin-top: .6rem !important; overflow-wrap: anywhere; }
.admin-card, .access-code-section, .section-panel, .admin-main > section {
  background: var(--admin-card) !important;
  border: 1px solid #e6e0d6 !important;
  border-radius: 12px !important;
  box-shadow: 0 14px 34px rgba(49,42,32,.045) !important;
}
.admin-card { padding: clamp(1rem, 2vw, 1.65rem) !important; }
.admin-card h2, .admin-main h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem !important;
  font-weight: 500 !important;
  letter-spacing: -.015em;
  margin-bottom: 1.1rem !important;
  padding-bottom: .85rem !important;
  border-bottom: 1px solid #ebe5db !important;
}
.admin-card h2 i, .admin-main h2 i { color: var(--admin-clay) !important; font-size: .9em; }
.admin-grid { grid-template-columns: minmax(0, 1.5fr) minmax(310px, .85fr) !important; gap: 1.3rem !important; }
.admin-grid > .admin-card:first-child { grid-column: 2; grid-row: 1; }
.admin-grid > .admin-card:nth-child(2) { grid-column: 1; grid-row: 1; }
.admin-body label { color: #514a43 !important; font-size: .82rem; font-weight: 650; gap: 7px; }
.admin-body input:not([type="file"]), .admin-body select, .admin-body textarea {
  min-height: 46px;
  padding: .7rem .85rem !important;
  border: 1px solid #ded8ce !important;
  border-radius: 7px !important;
  background: #fff !important;
  color: #292622 !important;
  font-family: inherit;
  font-size: .87rem;
}
.admin-body textarea { min-height: 94px; }
.admin-body input:focus-visible, .admin-body select:focus-visible, .admin-body textarea:focus-visible,
.admin-body button:focus-visible, .admin-body a:focus-visible, .admin-body [tabindex="0"]:focus-visible {
  outline: 3px solid rgba(128,80,71,.25) !important;
  outline-offset: 2px;
}
.admin-body .button.primary, .admin-body button.button.primary {
  background: var(--admin-clay) !important;
  color: #fff !important;
  border: 1px solid var(--admin-clay) !important;
  border-radius: 7px !important;
  box-shadow: 0 7px 18px rgba(128,80,71,.14);
}
.admin-body .button.primary:hover { background: #663d36 !important; border-color: #663d36 !important; }
.admin-body .button.secondary, .admin-body .btn-outline { border-radius: 7px !important; }
.admin-body .muted { color: var(--admin-muted) !important; }

#gallerySearch {
  min-height: 48px !important;
  margin-bottom: 1rem !important;
  border-radius: 7px !important;
  background-color: #f8f6f2 !important;
}
#galleriesList { gap: 12px; }
#galleriesList .gallery-row {
  grid-template-columns: 128px minmax(140px, 1fr) minmax(120px, auto) auto !important;
  gap: 16px !important;
  padding: 11px !important;
  background: #fffdfa !important;
  border: 1px solid #ebe5db !important;
  border-radius: 10px !important;
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease !important;
}
#galleriesList .gallery-row:hover { border-color: #c9b485 !important; box-shadow: 0 12px 28px rgba(55,44,29,.08) !important; transform: translateY(-2px); }
.gallery-cover { width: 128px !important; aspect-ratio: 4 / 3 !important; border-radius: 6px !important; background: #e9e2d8; }
.gallery-cover img { transition: transform .45s ease; }
.gallery-row:hover .gallery-cover img { transform: scale(1.04); }
.gallery-identity { align-content: center; gap: 7px !important; }
.gallery-identity strong { font: 500 1.25rem/1.2 Georgia, "Times New Roman", serif !important; }
.gallery-identity .muted { font-size: .76rem !important; }
.gallery-row-meta { gap: 9px !important; align-content: center; font-size: .76rem !important; }
.gallery-row-meta span { color: #766f66; }
.gallery-row-meta i { color: var(--admin-clay) !important; }
#galleriesList .thumb-actions { align-content: center; justify-content: flex-end; gap: 7px !important; }
#galleriesList .thumb-actions .button { min-height: 38px !important; padding: .45rem .75rem !important; font-size: .7rem !important; font-weight: 700; }
#galleriesList .thumb-actions a.button { color: #fff !important; background: var(--admin-clay) !important; border: 1px solid var(--admin-clay) !important; }
#galleriesList .thumb-actions button.button.secondary { background: #f2eee7 !important; border: 1px solid #e4ddd2 !important; color: #3c3934 !important; }
#galleriesList .thumb-actions button.button.danger { background: #fff8f6 !important; border: 1px solid #e7cbc4 !important; color: #8e5046 !important; }
#galleriesList .gallery-notes-row { border-color: #eee8df !important; color: #77716a !important; font-size: .76rem !important; }
.table-list:empty::after { border-color: #dfd8cd !important; background: #faf8f4 !important; color: var(--admin-muted) !important; }

.admin-top:has(#manageTitle) { padding-bottom: 1.25rem; border-bottom: 1px solid #e1dbd1; }
#manageTitle { max-width: 17ch; }
#galleryLink { display: inline-flex; align-items: center; gap: 7px; color: var(--admin-clay) !important; font-size: .78rem !important; }
.admin-actions .button { min-height: 44px; }
.access-code-section {
  min-height: 92px;
  padding: 1rem 1.25rem !important;
  border-inline-start: 3px solid var(--admin-gold) !important;
  margin-bottom: 1.25rem !important;
  gap: .75rem !important;
}
.access-code-section .code-label small { color: var(--admin-muted) !important; letter-spacing: .14em !important; }
.access-code-section .code-value { color: #37302a !important; background: #f7f4ee !important; border: 1px solid #e6dfd3 !important; border-radius: 6px !important; font-size: 1.3rem !important; }
.admin-main > .admin-card { margin-bottom: 1.1rem !important; }
.admin-main > .admin-card h2 { display: flex; align-items: center; gap: .65rem; }
.admin-main > .admin-card h2::after { content: ""; height: 1px; flex: 1; background: #ebe5db; }
.section-panel { padding: 1rem !important; gap: .7rem !important; background: #faf8f4 !important; box-shadow: none !important; }
.section-panel label { color: #5f574e !important; }
.section-panel .section-row { gap: 8px !important; }
.section-panel .section-row select, .section-panel .section-row input { border-radius: 6px !important; }
.section-toolbar { margin-bottom: .8rem !important; }
.dropzone {
  min-height: 150px;
  padding: 1.25rem 1.5rem !important;
  display: grid !important;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  justify-content: start !important;
  align-content: center;
  gap: 4px 15px !important;
  text-align: start !important;
  background: #f7f4ee !important;
  border: 1px dashed #c8beb0 !important;
  border-radius: 8px !important;
}
.dropzone i { grid-row: 1 / span 2; align-self: center; color: var(--admin-clay) !important; font-size: 2rem !important; margin: 0 !important; }
.dropzone strong { align-self: end; color: #302c27 !important; font-size: .9rem !important; font-weight: 650 !important; }
.dropzone span { align-self: start; color: #81796e !important; font-size: .75rem !important; }
.dropzone:hover, .dropzone.is-dragging { background: #f1ece3 !important; border-color: var(--admin-clay) !important; }
.progress-list { margin-top: 1rem !important; }
.upload-summary { border: 1px solid #e6dfd4; border-radius: 8px; background: #faf8f4; padding: 1rem; }
.section-block { margin-top: 1.6rem !important; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .4rem 0 .8rem; margin-bottom: .8rem; border-bottom: 1px solid #e8e1d7; }
.section-heading h3 { margin: 0; color: #302b26; font: 500 1.25rem Georgia, "Times New Roman", serif; }
.section-count { color: #80786e; background: #eee9e0; border-radius: 999px; padding: .25rem .65rem; font-size: .69rem; font-weight: 700; }
.thumb-grid { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)) !important; gap: 13px !important; }
.thumb-card { aspect-ratio: 4 / 5 !important; border: 1px solid #e7e0d5 !important; border-radius: 7px !important; background: #e9e4db !important; box-shadow: 0 4px 14px rgba(37,31,24,.055) !important; }
.thumb-card:hover { transform: translateY(-3px) !important; border-color: #c6b48d !important; box-shadow: 0 14px 30px rgba(37,31,24,.14) !important; }
.thumb-card .thumb-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #e9e4db; }
.thumb-card::after { content: ""; position: absolute; inset: 35% 0 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(20,18,16,.76)); }
.thumb-card .thumb-file-name { position: absolute; z-index: 2; inset-inline: 10px; bottom: 49px; overflow: hidden; color: white; font-size: .68rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.thumb-card .thumb-actions { z-index: 3; inset-inline: 7px !important; bottom: 7px !important; gap: 5px !important; opacity: 1 !important; }
.thumb-card .thumb-actions a, .thumb-card .thumb-actions button { flex: 1; min-height: 34px; padding: .35rem .4rem !important; border: 1px solid rgba(255,255,255,.34) !important; border-radius: 5px !important; background: rgba(30,27,24,.76) !important; color: white !important; backdrop-filter: blur(8px); font-size: .66rem !important; }
.thumb-card .thumb-actions a:hover { background: var(--admin-clay) !important; }
.thumb-card .thumb-actions button:hover { background: #8e5046 !important; }
.thumb-card .card-status { z-index: 4; inset-inline: 8px; top: 8px; margin: 0; color: white !important; font-size: .65rem; text-shadow: 0 1px 5px rgba(0,0,0,.8); }
#sectionsManage .trash-row { border: 1px solid #e8e1d7 !important; border-radius: 8px !important; background: #fffdfa !important; padding: .95rem 1rem !important; }
#sectionsManage .trash-row h3 { color: #302b26; font: 500 1.05rem Georgia, "Times New Roman", serif; }
#sectionsManage .trash-row small { color: var(--admin-muted); }
#sectionsManage .trash-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#sectionsManage .trash-actions .button { min-height: 36px; font-size: .69rem; }

html[data-theme="dark"] body.admin-body {
  --admin-ink: #f2efe9;
  --admin-muted: #aaa39a;
  --admin-paper: #151412;
  --admin-card: #201e1a;
  color: var(--admin-ink) !important;
  background-image: radial-gradient(ellipse at 78% 0%, rgba(196,161,92,.07), transparent 36%);
}
html[data-theme="dark"] body.admin-body .admin-card,
html[data-theme="dark"] body.admin-body .access-code-section,
html[data-theme="dark"] body.admin-body .section-panel,
html[data-theme="dark"] body.admin-body .admin-main > section { background: var(--admin-card) !important; border-color: #37332c !important; }
html[data-theme="dark"] body.admin-body .admin-top:has(#manageTitle) { border-color: #37332c; }
html[data-theme="dark"] body.admin-body .admin-card h2,
html[data-theme="dark"] body.admin-body .admin-main h2,
html[data-theme="dark"] body.admin-body .section-heading h3,
html[data-theme="dark"] body.admin-body #sectionsManage .trash-row h3 { color: #f1ece4 !important; border-color: #37332c !important; }
html[data-theme="dark"] body.admin-body .section-heading { border-color: #37332c; }
html[data-theme="dark"] body.admin-body .admin-body label { color: #ded8ce !important; }
html[data-theme="dark"] body.admin-body input:not([type="file"]),
html[data-theme="dark"] body.admin-body select,
html[data-theme="dark"] body.admin-body textarea { background: #191815 !important; border-color: #423d34 !important; color: #f0ece5 !important; }
html[data-theme="dark"] body.admin-body #gallerySearch { background-color: #191815 !important; }
html[data-theme="dark"] body.admin-body #galleriesList .gallery-row,
html[data-theme="dark"] body.admin-body #sectionsManage .trash-row,
html[data-theme="dark"] body.admin-body .upload-summary { background: #191815 !important; border-color: #37332c !important; }
html[data-theme="dark"] body.admin-body .gallery-identity strong,
html[data-theme="dark"] body.admin-body #galleriesList .gallery-row > div { color: #f1ece4 !important; }
html[data-theme="dark"] body.admin-body .dropzone { background: #191815 !important; border-color: #4c4539 !important; }
html[data-theme="dark"] body.admin-body .dropzone strong { color: #f1ece4 !important; }
html[data-theme="dark"] body.admin-body .section-count { background: #302c25; color: #d5c7a8; }
html[data-theme="dark"] body.admin-body .access-code-section .code-value { background: #29251e !important; color: #f1ece4 !important; border-color: #423d34 !important; }

@media (max-width: 1100px) {
  .admin-grid { grid-template-columns: minmax(0, 1.25fr) minmax(270px, .8fr) !important; }
  #galleriesList .gallery-row { grid-template-columns: 104px minmax(0, 1fr) auto !important; }
  .gallery-cover { width: 104px !important; }
  .gallery-row-meta { grid-column: 2; display: flex; flex-wrap: wrap; }
  #galleriesList .thumb-actions { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; }
}
@media (max-width: 768px) {
  .admin-sidebar { width: 100% !important; }
  .admin-main { padding: 1.05rem !important; }
  .admin-top h1 { font-size: clamp(1.9rem, 7vw, 2.65rem) !important; }
  .admin-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .admin-grid > .admin-card:first-child { grid-column: 1; grid-row: 2; }
  .admin-grid > .admin-card:nth-child(2) { grid-column: 1; grid-row: 1; }
  #galleriesList .gallery-row { grid-template-columns: 104px minmax(0, 1fr) !important; gap: 10px 13px !important; }
  .gallery-cover { grid-column: 1 !important; grid-row: 1 / span 2 !important; width: 104px !important; }
  .gallery-identity { grid-column: 2 !important; grid-row: 1 !important; }
  .gallery-row-meta { grid-column: 2 !important; grid-row: 2 !important; display: flex; flex-wrap: wrap; }
  #galleriesList .thumb-actions { grid-column: 1 / -1 !important; grid-row: 3 !important; flex-direction: row; justify-content: flex-start !important; }
  #galleriesList .gallery-notes-row { grid-column: 1 / -1 !important; }
  .dropzone { grid-template-columns: 40px minmax(0,1fr) !important; min-height: 128px; padding: 1rem !important; gap: 3px 12px !important; }
  .dropzone i { font-size: 1.6rem !important; }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)) !important; }
}
@media (max-width: 520px) {
  .admin-sidebar { display: grid !important; grid-template-columns: minmax(0,1fr) auto auto !important; }
  .admin-sidebar .brand { grid-column: 1; }
  .admin-sidebar > .admin-preferences { grid-column: 2; grid-row: 1; }
  .admin-sidebar .hamburger-btn { grid-column: 3; grid-row: 1; order: initial !important; }
  .admin-sidebar nav { grid-column: 1 / -1; grid-row: 2; order: initial !important; }
  .admin-language-toggle { min-width: 67px; padding-inline: 8px; font-size: .72rem !important; }
  .admin-theme-toggle { width: 36px; }
  .admin-main { padding: .85rem !important; }
  .admin-card { padding: .9rem !important; }
  .admin-grid > .admin-card:first-child { padding: 1rem !important; }
  #galleriesList .gallery-row { grid-template-columns: 86px minmax(0,1fr) !important; padding: 8px !important; }
  .gallery-cover { width: 86px !important; }
  .gallery-identity strong { font-size: 1.05rem !important; }
  .gallery-row-meta { gap: 6px 10px !important; font-size: .68rem !important; }
  #galleriesList .thumb-actions .button { min-height: 36px !important; padding: .4rem .62rem !important; }
  .access-code-section { padding: .9rem !important; }
  .access-code-section .code-value { font-size: 1.1rem !important; }
  .admin-actions { width: auto !important; }
  .admin-actions .button { flex: initial !important; }
  .section-toolbar { flex-direction: row !important; }
  .section-toolbar .button { width: auto !important; }
  #sectionsManage .trash-row { grid-template-columns: 1fr !important; gap: .75rem; }
  .thumb-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 8px !important; }
}

/* Calm editorial hierarchy for the gallery workspace. */
body.admin-body .admin-top:has(#manageTitle) { margin-bottom: 1.4rem !important; padding-bottom: 1.2rem; border-bottom: 1px solid #e6dfd4; }
body.admin-body #manageTitle { font-family: Georgia, "Times New Roman", serif; font-weight: 500 !important; letter-spacing: -.035em !important; }
body.admin-body #galleryLink { min-height: 1.5rem; }
body.admin-body .access-code-section { margin-block: 1rem 1.35rem !important; padding: 1rem 1.25rem !important; border: 1px solid #dfd1b2 !important; background: #f8f3e9 !important; }
body.admin-body .access-code-section .code-value { font: 600 1rem ui-monospace, SFMono-Regular, Consolas, monospace !important; letter-spacing: .1em; }
body.admin-body .admin-card { margin-bottom: 1.25rem !important; }
body.admin-body .section-toolbar { gap: .65rem !important; margin-bottom: .8rem; }
body.admin-body .dropzone { min-height: 112px !important; padding: 1.1rem 1.3rem !important; }
body.admin-body #filesGrid > .muted { padding: 2rem; border: 1px dashed #d8d0c4; border-radius: 9px; text-align: center; background: rgba(255,255,255,.45); }
#filesGrid { display: flex !important; flex-direction: column !important; gap: 1.4rem !important; }
#filesGrid > .section-block { width: 100%; margin: 0 !important; }
#filesGrid > .section-block > .thumb-grid { display: grid !important; width: 100%; }
.section-heading h3 { font-size: clamp(1.05rem, 2vw, 1.3rem) !important; }
.thumb-card .thumb-file-name { max-width: calc(100% - 20px); }
.thumb-card .card-status:empty { display: none !important; }
.thumb-card .thumb-actions a:focus-visible, .thumb-card .thumb-actions button:focus-visible { outline: 3px solid #f1d89d !important; outline-offset: 2px; }
.thumb-card:focus-within { border-color: #a88645 !important; }
body.admin-body #sectionsManage .trash-row { transition: border-color .18s ease, background .18s ease; }
body.admin-body #sectionsManage .trash-row:hover { border-color: #c6b48d !important; }
html[data-theme="dark"] body.admin-body .admin-top:has(#manageTitle) { border-color: #37332c; }
html[data-theme="dark"] body.admin-body .access-code-section { background: #29251e !important; border-color: #574a30 !important; }
html[data-theme="dark"] body.admin-body #filesGrid > .muted { background: #191815; border-color: #494337; }

@media (min-width: 1101px) {
  body.admin-body .admin-layout:has(#manageTitle) .admin-main { max-width: 1720px; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-top { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
  body.admin-body .admin-layout:has(#manageTitle) #galleryLink { flex: 1; max-width: 480px; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section { justify-content: flex-start; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section .code-label { margin-inline-end: auto; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) { display: grid; grid-template-columns: minmax(250px, .72fr) minmax(0, 1.55fr); align-items: center; column-gap: 1.5rem; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > h2 { grid-column: 1 / -1; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .section-panel { grid-column: 1; grid-row: 2; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .section-toolbar { grid-column: 1; grid-row: 3; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > #galleryDropzone { grid-column: 2; grid-row: 2 / span 2; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > #uploadProgress { grid-column: 2; grid-row: 4; }
}
@media (max-width: 768px) {
  body.admin-body .admin-layout:has(#manageTitle) .admin-top { display: grid; gap: .6rem; }
  body.admin-body .admin-layout:has(#manageTitle) #galleryLink { overflow-wrap: anywhere; }
  body.admin-body .access-code-section { align-items: flex-start !important; }
  .thumb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .thumb-card .thumb-actions { inset-inline: 5px !important; bottom: 5px !important; gap: 4px !important; }
  .thumb-card .thumb-actions a, .thumb-card .thumb-actions button { min-height: 32px; padding-inline: .3rem !important; font-size: .62rem !important; }
}
@media (max-width: 380px) {
  .thumb-grid { grid-template-columns: minmax(0, 1fr) !important; }
  body.admin-body .access-code-section { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  body.admin-body .thumb-card, body.admin-body #sectionsManage .trash-row { transition: none !important; }
  body.admin-body .thumb-card:hover { transform: none !important; }
}

/* Admin brand rail and compact mobile header. */
body.admin-body .admin-sidebar {
  background: #211f1c !important;
  border-inline-end: 1px solid rgba(255,255,255,.08) !important;
  box-shadow: 12px 0 36px rgba(29,25,20,.045);
}
body.admin-body .admin-sidebar .brand {
  min-height: 46px;
  color: #f6f1e8 !important;
  font: 600 1.04rem/1 Georgia, "Times New Roman", serif !important;
  white-space: nowrap;
}
body.admin-body .admin-sidebar .brand-mark { box-shadow: 0 0 0 4px rgba(198,164,92,.12); }
body.admin-body .admin-sidebar nav { gap: 6px !important; }
body.admin-body .admin-sidebar nav a {
  position: relative;
  min-height: 46px;
  padding: .7rem .9rem !important;
  color: #d4cec4 !important;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
body.admin-body .admin-sidebar nav a i { color: #b6a06f; }
body.admin-body .admin-sidebar nav a:hover { color: #fff !important; transform: translateX(-2px); }
body.admin-body .admin-sidebar nav a.active {
  color: #f4dfae !important;
  background: linear-gradient(100deg, rgba(198,164,92,.19), rgba(198,164,92,.06)) !important;
  box-shadow: inset 3px 0 #c6a45c !important;
}
body.admin-body .admin-sidebar nav a.active i { color: #e1c37d; }
body.admin-body .admin-sidebar nav button#logoutBtn { min-height: 44px; border-radius: 8px !important; }
body.admin-body .admin-sidebar .admin-preferences { gap: 8px; }
body.admin-body .admin-sidebar .admin-preferences button { box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); }
body.admin-body .hamburger-btn { border: 1px solid rgba(198,164,92,.36); border-radius: 10px; }
body.admin-body .hamburger-btn:hover { background: rgba(198,164,92,.12); }

@media (max-width: 768px) {
  body.admin-body .admin-sidebar {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto auto !important;
    align-items: center !important;
    min-height: 78px;
    height: auto !important;
    padding: .65rem 1rem !important;
    gap: .45rem .65rem !important;
    border-inline: 0 !important;
    border-bottom: 1px solid rgba(198,164,92,.22) !important;
    box-shadow: 0 8px 24px rgba(20,18,15,.13);
  }
  body.admin-body .admin-sidebar .brand { grid-column: 1; grid-row: 1; min-width: 0; font-size: 1rem !important; }
  body.admin-body .admin-sidebar > .admin-preferences { grid-column: 2; grid-row: 1; margin: 0 !important; gap: 6px; }
  body.admin-body .admin-sidebar .admin-language-toggle { min-width: 76px; min-height: 38px; padding-inline: 10px; font-size: .74rem !important; }
  body.admin-body .admin-sidebar .admin-theme-toggle { width: 38px; min-height: 38px; }
  body.admin-body .admin-sidebar .hamburger-btn {
    display: grid !important;
    place-items: center;
    grid-column: 3;
    grid-row: 1;
    order: initial !important;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #f4ead5;
  }
  body.admin-body .admin-sidebar nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    gap: 4px !important;
    margin: .3rem 0 0 !important;
    padding: .55rem !important;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 11px;
    background: #292722 !important;
    box-shadow: 0 16px 30px rgba(15,13,11,.2);
  }
  body.admin-body .admin-sidebar nav.open { display: flex !important; }
  body.admin-body .admin-sidebar nav a { min-height: 44px; padding-inline: .85rem !important; }
  body.admin-body .admin-sidebar nav a.active { box-shadow: inset 3px 0 #c6a45c !important; }
  body.admin-body .admin-sidebar nav button#logoutBtn { margin-top: .35rem; }
}
@media (max-width: 380px) {
  body.admin-body .admin-sidebar { grid-template-columns: minmax(0,1fr) auto auto !important; padding-inline: .75rem !important; }
  body.admin-body .admin-sidebar .brand { font-size: .9rem !important; }
  body.admin-body .admin-sidebar .brand-mark { width: 36px; height: 36px; }
  body.admin-body .admin-sidebar .admin-language-toggle { min-width: 66px; padding-inline: 7px; }
}
@media (max-width: 768px) {
  body.admin-body .admin-layout:has(#manageTitle) .admin-top {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    grid-template-rows: auto auto auto;
    align-items: center;
    gap: .15rem .85rem !important;
    margin-bottom: 1rem !important;
    padding-bottom: .9rem;
  }
  body.admin-body .admin-layout:has(#manageTitle) .admin-top > div:first-child { display: contents; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-top .eyebrow { grid-column: 1; grid-row: 1; margin: 0 0 .25rem; }
  body.admin-body .admin-layout:has(#manageTitle) #manageTitle { grid-column: 1; grid-row: 2; min-width: 0; overflow-wrap: anywhere; font-size: clamp(1.55rem, 5.2vw, 2rem) !important; }
  body.admin-body .admin-layout:has(#manageTitle) #galleryLink { grid-column: 1; grid-row: 3; min-width: 0; margin-top: .3rem; overflow-wrap: anywhere; font-size: .69rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions { grid-column: 2; grid-row: 1 / 4; align-self: center; width: auto !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions .button { width: auto !important; min-width: 132px; min-height: 42px; padding-inline: .8rem !important; font-size: .7rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: .65rem !important;
    min-height: 76px;
    padding: .75rem .85rem !important;
    margin-block: .85rem 1rem !important;
  }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section .code-label {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: start;
    gap: .2rem .5rem;
    min-width: 0;
  }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section .code-label small { grid-column: 1 / -1; font-size: .64rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section .code-value { font-size: .91rem !important; padding: .35rem .55rem !important; letter-spacing: .08em; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section > .button { width: auto !important; flex: 0 0 auto; min-height: 40px; padding: .45rem .7rem !important; font-size: .67rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card { padding: 1rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card h2 { margin-bottom: .85rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .section-panel .section-row {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) 104px;
    align-items: center;
    gap: .5rem !important;
  }
  body.admin-body .admin-layout:has(#manageTitle) .section-panel .section-row select { grid-column: 1 / -1; width: 100% !important; }
  body.admin-body .admin-layout:has(#manageTitle) .section-panel .section-row input { grid-column: 1; width: 100% !important; min-width: 0 !important; }
  body.admin-body .admin-layout:has(#manageTitle) .section-panel .section-row .button { grid-column: 2; width: 100% !important; min-height: 46px; padding-inline: .45rem !important; }
  body.admin-body .admin-layout:has(#manageTitle) .section-toolbar { display: flex; flex-direction: row !important; justify-content: flex-start; }
  body.admin-body .admin-layout:has(#manageTitle) .section-toolbar .button { width: auto !important; min-height: 42px; padding-inline: .85rem !important; }
}
@media (max-width: 440px) {
  body.admin-body .admin-layout:has(#manageTitle) .admin-top { grid-template-columns: minmax(0,1fr) !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions { grid-column: 1; grid-row: 4; justify-self: start; margin-top: .55rem; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions .button { min-width: 140px; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section { align-items: flex-start !important; flex-wrap: wrap; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section > .button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  body.admin-body .admin-sidebar nav a { transition: none !important; }
  body.admin-body .admin-sidebar nav a:hover { transform: none !important; }
}

/* Keep the admin controls anchored while the content direction changes. */
body.admin-body .admin-preferences { direction: ltr !important; }
body.admin-body .admin-sidebar { direction: ltr !important; }
html[dir="rtl"] body.admin-body .admin-sidebar nav { direction: rtl; }
html[dir="ltr"] body.admin-body .admin-sidebar nav { direction: ltr; }
body.admin-body .admin-login-preferences {
  position: fixed !important;
  top: 24px !important;
  inset-inline-end: auto !important;
  left: auto !important;
  right: 28px !important;
}
@media (max-width: 520px) {
  body.admin-body .admin-login-preferences { top: 14px !important; right: 14px !important; }
}

/* Consistent task flow, spacing, and responsive shell across every admin page. */
body.admin-body {
  --admin-ink: #292722;
  --admin-muted: #746f66;
  --admin-paper: #f5f2ec;
  --admin-card: #fffefa;
  --admin-line: #e6e0d6;
  --admin-gold: #c4a15c;
  --admin-clay: #805047;
  overflow-x: hidden;
}

.admin-layout {
  display: flex;
  direction: ltr;
  align-items: stretch;
  min-height: 100svh;
  width: 100%;
}
html[dir="rtl"] body.admin-body .admin-sidebar,
html[dir="rtl"] body.admin-body .admin-main { direction: rtl; }
html[dir="ltr"] body.admin-body .admin-sidebar,
html[dir="ltr"] body.admin-body .admin-main { direction: ltr; }

.admin-sidebar {
  flex: 0 0 248px;
  width: 248px !important;
  min-width: 248px;
  min-height: 100svh;
  position: sticky;
  top: 0;
  align-self: flex-start;
}
.admin-sidebar .brand { gap: 12px; }
.admin-sidebar nav a,
.admin-sidebar nav button { min-height: 46px; }
.admin-sidebar nav a[aria-current="page"] {
  color: #f4dfae !important;
  background: linear-gradient(100deg, rgba(198,164,92,.19), rgba(198,164,92,.06)) !important;
  box-shadow: inset 3px 0 #c6a45c !important;
}
html[dir="ltr"] .back-arrow { transform: rotate(180deg); }

.admin-main {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: 1640px;
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 3.25rem) !important;
}
.admin-top { align-items: center; margin-bottom: clamp(1.25rem, 2.5vw, 2rem) !important; }
.admin-top > div { min-width: 0; }
.admin-page-intro {
  max-width: 68ch;
  margin: .55rem 0 0;
  color: var(--admin-muted);
  font-size: .9rem;
  line-height: 1.75;
}

.admin-grid {
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.2fr) !important;
  gap: clamp(.9rem, 1.5vw, 1.35rem) !important;
}
.admin-grid > .admin-card:first-child,
.admin-grid > .admin-card:nth-child(2) { grid-column: auto !important; grid-row: auto !important; }
.admin-card,
.admin-main > section {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.65rem) !important;
  border-radius: 13px !important;
}
.admin-card-heading {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1.15rem;
}
.admin-card-heading > div { min-width: 0; flex: 1; }
.admin-step-number {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(128,80,71,.22);
  border-radius: 50%;
  background: #f7f1e6;
  color: var(--admin-clay);
  font: 700 .7rem/1 "Manrope", Arial, sans-serif;
  letter-spacing: .04em;
}
.admin-card-heading h2 {
  margin: 0 0 .35rem !important;
  padding: 0 0 .65rem !important;
  border-bottom: 1px solid var(--admin-line) !important;
}
.admin-card-intro {
  margin: 0;
  color: var(--admin-muted);
  font-size: .79rem;
  line-height: 1.7;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#createGalleryForm { gap: 1rem !important; }
#createGalleryForm label { min-width: 0; line-height: 1.6; }
#createGalleryForm label small { font-size: .74rem !important; line-height: 1.5; }
#createGalleryForm .full { grid-column: 1 / -1; }
#createGalleryForm .slug-row { display: flex; gap: .5rem; min-width: 0; }
#createGalleryForm .slug-row input { min-width: 0; flex: 1; }
#createGalleryForm .slug-row button { flex: 0 0 auto; }
#createGalleryForm > button[type="submit"] { min-height: 48px; }
#createStatus { min-height: 1.3em; margin-top: .65rem; }
#gallerySearch { width: 100%; margin-bottom: 1rem !important; }
#galleriesList { min-width: 0; }
#galleriesList .gallery-row {
  grid-template-columns: 94px minmax(130px, 1fr) minmax(112px, auto) auto !important;
  gap: .85rem !important;
  padding: .8rem !important;
}
#galleriesList .gallery-row:focus-within { outline: 2px solid rgba(128,80,71,.3); outline-offset: 2px; }
#galleriesList .gallery-identity strong { font-size: 1.08rem !important; }
#galleriesList .gallery-row-meta { white-space: normal; }
#galleriesList .thumb-actions .button { min-height: 42px !important; }

body.admin-body .admin-layout:has(#manageTitle) .admin-top { gap: 1rem; }
body.admin-body .admin-layout:has(#manageTitle) .admin-top > div:first-child { min-width: 0; }
body.admin-body .admin-layout:has(#manageTitle) #galleryLink { overflow-wrap: anywhere; line-height: 1.6; }
body.admin-body .admin-layout:has(#manageTitle) .admin-actions { gap: .55rem; }
body.admin-body .admin-layout:has(#manageTitle) .admin-actions .button { min-height: 44px; }
.access-code-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.15rem !important;
  padding: 1rem 1.2rem !important;
}
.access-code-context { display: flex; align-items: center; gap: .7rem; margin-inline-end: auto; }
.access-code-title { color: var(--admin-ink); font-weight: 700; font-size: .95rem; }
.code-label { display: grid; gap: .3rem; }
.code-label small { color: var(--admin-muted); font-size: .75rem; }
.access-code-section .code-value { display: inline-block; padding: .4rem .7rem !important; font-size: 1rem; }
.access-code-section .button { min-height: 44px; }

body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) {
  display: grid;
  grid-template-columns: minmax(250px, .78fr) minmax(0, 1.22fr);
  align-items: start;
  gap: 1rem 1.25rem;
}
body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .admin-card-heading,
body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > #uploadProgress { grid-column: 1 / -1; }
body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .admin-card-heading { margin-bottom: 0; }
.section-panel {
  align-self: stretch;
  min-width: 0;
  padding: 1rem !important;
  border-radius: 10px !important;
  background: #f9f7f2 !important;
  box-shadow: none !important;
}
.section-panel > label { display: block; margin-bottom: .65rem; font-size: .82rem; font-weight: 700; }
.section-panel .section-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem !important; }
.section-panel .section-row select { grid-column: 1 / -1; width: 100%; }
.section-panel .section-row input { width: 100%; min-width: 0; }
.section-panel .section-row .button { min-height: 46px; }
.section-panel > small { display: block; margin-top: .7rem !important; color: var(--admin-muted) !important; line-height: 1.55; }
.upload-workspace { display: grid; align-content: start; gap: .65rem; min-width: 0; }
body.admin-body .upload-workspace .dropzone {
  min-height: 172px !important;
  padding: 1.5rem !important;
  border-radius: 10px !important;
  background: #faf8f3 !important;
  text-align: center;
}
.upload-workspace .dropzone > i { font-size: 1.7rem; }
.upload-workspace .dropzone strong { max-width: 38ch; line-height: 1.6; }
.upload-workspace .dropzone span { color: var(--admin-muted); font-size: .8rem; }
.upload-workspace .section-toolbar { display: flex; justify-content: flex-start; margin: 0 !important; }
.upload-workspace .section-toolbar .button { min-height: 44px; }
body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > #uploadProgress { width: 100%; }
#uploadProgress:empty, #portfolioProgress:empty { display: none; }

#filesGrid { display: flex !important; flex-direction: column !important; gap: 1.1rem !important; }
#filesGrid > .section-block { margin: 0 !important; padding: 1rem; border: 1px solid var(--admin-line); border-radius: 10px; background: rgba(248,246,241,.55); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .8rem; }
.section-heading h3 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 1rem !important; }
.section-count { flex: 0 0 auto; padding: .3rem .6rem; border-radius: 999px; background: #f0ece3; color: #665d4d; font-size: .7rem; }
.sections-management { margin-top: 1rem; border-top: 1px solid var(--admin-line); }
.sections-management summary { display: flex; align-items: center; gap: .55rem; min-height: 48px; color: var(--admin-ink); cursor: pointer; font-size: .88rem; font-weight: 700; list-style-position: inside; }
.sections-management summary i { color: var(--admin-clay); }
.sections-management[open] > .admin-card-intro { margin: 0 0 .85rem; }
#sectionsManage { display: grid; gap: .6rem; }
#sectionsManage .trash-row { grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; }
#sectionsManage .trash-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
#sectionsManage .trash-actions .button { min-height: 42px; }
.gallery-empty-state { display: grid; place-items: center; min-height: 132px; margin: 0; padding: 1.5rem; border: 1px dashed var(--admin-line); border-radius: 10px; color: var(--admin-muted); text-align: center; background: rgba(248,246,241,.55); }

.auth-description { margin: -.5rem 0 1.4rem; color: var(--admin-muted); font-size: .88rem; line-height: 1.7; }
.admin-body .button, .admin-body button { min-height: 42px; }
.admin-body :focus-visible { scroll-margin-block: 6rem; }

html[data-theme="dark"] body.admin-body {
  --admin-ink: #f1ece4;
  --admin-muted: #b1aa9f;
  --admin-paper: #171613;
  --admin-card: #211f1b;
  --admin-line: #3b362e;
  --admin-gold: #c4a15c;
  color: var(--admin-ink) !important;
  background: var(--admin-paper) !important;
}
html[data-theme="dark"] body.admin-body .admin-card,
html[data-theme="dark"] body.admin-body .admin-main > section,
html[data-theme="dark"] body.admin-body .section-panel,
html[data-theme="dark"] body.admin-body #filesGrid > .section-block { background: var(--admin-card) !important; border-color: var(--admin-line) !important; }
html[data-theme="dark"] body.admin-body .admin-top h1,
html[data-theme="dark"] body.admin-body .admin-card h2,
html[data-theme="dark"] body.admin-body .admin-main h2,
html[data-theme="dark"] body.admin-body .access-code-title,
html[data-theme="dark"] body.admin-body .sections-management summary { color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .admin-page-intro,
html[data-theme="dark"] body.admin-body .admin-card-intro,
html[data-theme="dark"] body.admin-body .section-panel > small { color: var(--admin-muted) !important; }
html[data-theme="dark"] body.admin-body label { color: #e2dbcf !important; }
html[data-theme="dark"] body.admin-body label small,
html[data-theme="dark"] body.admin-body input::placeholder,
html[data-theme="dark"] body.admin-body textarea::placeholder { color: #aaa49a !important; }
html[data-theme="dark"] body.admin-body .admin-top .eyebrow { color: #d7b96d !important; }
html[data-theme="dark"] body.admin-body .admin-step-number,
html[data-theme="dark"] body.admin-body .section-count { background: #302a20; color: #e4c77f; border-color: #574a30; }
html[data-theme="dark"] body.admin-body .section-panel { background: #191815 !important; }
html[data-theme="dark"] body.admin-body .dropzone { background: #191815 !important; border-color: #514939 !important; color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .dropzone span,
html[data-theme="dark"] body.admin-body .section-heading h3 { color: var(--admin-ink); }
html[data-theme="dark"] body.admin-body .sections-management { border-color: var(--admin-line); }
html[data-theme="dark"] body.admin-body .access-code-section .code-value { background: #302a20 !important; color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body #galleriesList .gallery-row { background: #211f1b !important; border-color: var(--admin-line) !important; }
html[data-theme="dark"] body.admin-body #galleriesList .gallery-row strong { color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .storage-metric { background: #191815 !important; border-color: var(--admin-line) !important; color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .storage-metric-head strong,
html[data-theme="dark"] body.admin-body .storage-metric-foot .muted { color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .storage-metric-bar { background: #302e29 !important; border-color: #49443a !important; }
html[data-theme="dark"] body.admin-body .trash-row { background: #191815 !important; border-color: var(--admin-line) !important; }
html[data-theme="dark"] body.admin-body .trash-row h3,
html[data-theme="dark"] body.admin-body .trash-row strong,
html[data-theme="dark"] body.admin-body .trash-row .info .meta,
html[data-theme="dark"] body.admin-body .trash-row .deleted-at { color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .trash-row small { color: var(--admin-muted) !important; }
html[data-theme="dark"] body.admin-body .gallery-empty-state { border-color: var(--admin-line); background: #191815; color: var(--admin-muted); }
html[data-theme="dark"] body.admin-body .auth-card { background: #211f1b !important; border: 1px solid var(--admin-line) !important; color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .auth-card h1,
html[data-theme="dark"] body.admin-body .auth-card label { color: var(--admin-ink) !important; }
html[data-theme="dark"] body.admin-body .auth-card input { background: #191815 !important; border-color: var(--admin-line) !important; color: var(--admin-ink) !important; }

@media (max-width: 1020px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }
  #galleriesList .gallery-row { grid-template-columns: 78px minmax(120px, 1fr) auto !important; }
  #galleriesList .gallery-cover { width: 78px !important; max-width: 100%; }
  #galleriesList .gallery-identity { min-width: 0; }
  #galleriesList .gallery-row-meta { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: .35rem .8rem; }
  #galleriesList .thumb-actions { grid-column: 1 / -1; justify-content: flex-start !important; }
}
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    position: relative;
    top: auto;
    flex: 0 0 auto;
    width: 100% !important;
    min-width: 0;
    min-height: 0;
    height: auto !important;
    align-self: stretch;
    direction: ltr;
  }
  html[dir="rtl"] body.admin-body .admin-sidebar { direction: ltr; }
  .admin-main { max-width: none; padding: 1rem !important; }
  .admin-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .admin-grid > .admin-card:first-child,
  .admin-grid > .admin-card:nth-child(2) { grid-column: 1 !important; grid-row: auto !important; }
  .admin-grid > .admin-card:first-child { order: 1; }
  .admin-grid > .admin-card:nth-child(2) { order: 2; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) { grid-template-columns: minmax(0, 1fr); }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > * { grid-column: 1 !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .admin-card-heading { grid-row: 1; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .section-panel { grid-row: 2; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > .upload-workspace { grid-row: 3; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-card:has(#galleryDropzone) > #uploadProgress { grid-row: 4; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-top { grid-template-columns: minmax(0, 1fr) auto !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions { grid-column: 1 / -1; grid-row: 4; justify-content: flex-start; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section { display: flex !important; align-items: center !important; flex-wrap: wrap; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section > .button { flex: 0 0 auto; }
  #galleriesList .gallery-row { grid-template-columns: 72px minmax(0, 1fr) !important; }
  .gallery-cover { grid-column: 1; grid-row: 1 / span 2; width: 72px !important; }
  .gallery-identity { grid-column: 2; grid-row: 1; }
  .gallery-row-meta { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; }
  #galleriesList .thumb-actions { grid-column: 1 / -1; }
}
@media (max-width: 440px) {
  .admin-main { padding: .8rem !important; }
  .admin-card-heading { gap: .65rem; }
  .admin-step-number { flex-basis: 34px; width: 34px; height: 34px; }
  #createGalleryForm { grid-template-columns: minmax(0, 1fr) !important; }
  #createGalleryForm .full { grid-column: 1; }
  #createGalleryForm .slug-row { flex-direction: column; }
  #createGalleryForm .slug-row button { width: 100%; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-top { grid-template-columns: minmax(0,1fr) !important; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions { grid-column: 1; grid-row: auto; }
  body.admin-body .admin-layout:has(#manageTitle) .admin-actions .button { min-width: 0; flex: 1 1 auto; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section { display: grid !important; grid-template-columns: minmax(0,1fr) auto; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-context { grid-column: 1 / -1; margin: 0; }
  body.admin-body .admin-layout:has(#manageTitle) .access-code-section > .button { grid-column: 1 / -1; width: 100% !important; }
  #galleriesList .gallery-row { grid-template-columns: 62px minmax(0, 1fr) !important; padding: .7rem !important; }
  .gallery-cover { width: 62px !important; }
  #galleriesList .thumb-actions .button { flex: 1 1 auto; }
  #sectionsManage .trash-row { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 520px) {
  body.admin-body #trashList .trash-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  body.admin-body #trashList .trash-actions .button { width: 100%; min-width: 0; padding-inline: .45rem; font-size: .72rem; white-space: normal; line-height: 1.3; }
  body.admin-body #trashList .trash-actions .button:last-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  body.admin-body *, body.admin-body *::before, body.admin-body *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Keep gallery names in their own track when a dashboard column is narrow. */
#galleriesList .gallery-row {
  grid-template-columns: 104px minmax(0, 1fr) minmax(104px, auto) !important;
  align-items: center !important;
  column-gap: 14px !important;
  row-gap: 10px !important;
}
#galleriesList .gallery-cover { width: 104px !important; max-width: 100%; }
#galleriesList .gallery-identity { min-width: 0 !important; max-width: 100%; }
#galleriesList .gallery-identity strong {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}
#galleriesList .gallery-row-meta { min-width: 0; }
#galleriesList .thumb-actions {
  grid-column: 1 / -1 !important;
  justify-content: flex-start !important;
}
#galleriesList .gallery-notes-row { grid-column: 1 / -1 !important; min-width: 0; }

@media (max-width: 768px) {
  #galleriesList .gallery-row {
    grid-template-columns: 72px minmax(0, 1fr) !important;
    column-gap: 12px !important;
  }
  #galleriesList .gallery-cover { width: 72px !important; }
  #galleriesList .gallery-identity { grid-column: 2; grid-row: 1; }
  #galleriesList .gallery-row-meta { grid-column: 2; grid-row: 2; }
  #galleriesList .thumb-actions { grid-column: 1 / -1 !important; }
}
@media (max-width: 440px) {
  #galleriesList .gallery-row { grid-template-columns: 62px minmax(0, 1fr) !important; }
  #galleriesList .gallery-cover { width: 62px !important; }
}
