*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black: #1a1a1a;
  --gray-dark: #555;
  --gray-mid: #888;
  --gray-light: #d4d4d4;
  --gray-bg: #f7f7f5;
  --white: #ffffff;
  --sans: 'Geist', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --red: #c0392b;
  --green: #2ecc71;
  --radius: 8px;
  --radius-lg: 12px;
  --ease: cubic-bezier(0.165, 0.84, 0.44, 1);
  --shadow-card: 0 1px 2px -1px rgba(0,0,0,0.09), 0 3px 8px -2px rgba(0,0,0,0.07);
  --shadow-raised: 0 2px 4px -1px rgba(0,0,0,0.11), 0 10px 20px -4px rgba(0,0,0,0.09);
}

body {
  font-family: var(--sans);
  background: var(--white);
  color: var(--black);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ── NAV ── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px;
  border-bottom: 1px solid var(--gray-light);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--black);
}
.logo-img { height: 42px; width: auto; filter: invert(1); }
/* Same header as the fotomica.cl store, so the gallery reads as part of it. */
.nav-left { display: flex; align-items: center; gap: 32px; }
.nav-links { display: flex; gap: 20px; font-size: 13px; }
.nav-link.active { color: var(--black); font-weight: 500; }
.nav-store-mobile { display: none; }
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-store-mobile { display: inline; }
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  color: var(--gray-dark);
}
.nav-user { font-weight: 500; color: var(--black); text-decoration: none; }
.nav-user:hover { opacity: 0.7; }
.nav-link {
  text-decoration: none;
  color: var(--gray-dark);
  transition: color 0.15s;
}
.nav-link:hover { color: var(--black); }
.nav-badge {
  background: var(--black);
  color: var(--white);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ── ERROR PAGES ── */
.error-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.error-logo { margin-bottom: 48px; }
.error-logo .logo-img { height: 52px; }
.error-code {
  font-size: 96px;
  font-weight: 300;
  color: var(--gray-light);
  line-height: 1;
  margin-bottom: 16px;
  letter-spacing: -4px;
}
.error-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--black);
  margin-bottom: 12px;
}
.error-msg {
  font-size: 15px;
  color: var(--gray-dark);
  max-width: 380px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.error-hint {
  font-size: 13px;
  color: var(--gray-mid);
  margin-bottom: 36px;
  font-style: italic;
}
.error-btn {
  display: inline-block;
  width: auto;
  padding: 12px 28px;
  text-decoration: none;
  margin-top: 28px;
}

/* ── LOGIN ── */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 24px;
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 48px;
}
.login-logo .logo-img { height: 108px; width: auto; }
.login-box { width: 100%; max-width: 360px; }
.login-title {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 400;
  text-align: center;
  margin-bottom: 6px;
}
.login-sub {
  text-align: center;
  color: var(--gray-mid);
  font-size: 14px;
  margin-bottom: 32px;
}
.login-error {
  text-align: center;
  color: #c0392b;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-success {
  text-align: center;
  color: #2ecc71;
  font-size: 13px;
  margin-bottom: 16px;
}
.btn-sso { display: block; text-align: center; text-decoration: none; margin-top: 0; }
.login-or {
  text-align: center;
  font-size: 12px;
  color: var(--gray-mid);
  margin: 18px 0 14px;
}
.login-forgot {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
}
.login-forgot a {
  color: var(--gray-mid);
  text-decoration: none;
}
.login-forgot a:hover {
  color: var(--black);
  text-decoration: underline;
}
.field { margin-bottom: 14px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--black);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.field input::placeholder { color: var(--gray-mid); }
.field input:focus { border-color: var(--black); }
.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: opacity 0.15s;
  margin-top: 4px;
}
.btn-primary:hover { opacity: 0.85; }

/* ── GALLERY ── */
.gallery-wrap { padding: 40px 48px; max-width: 1280px; margin: 0 auto; width: 100%; }
.gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-light);
}
.gallery-title {
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
}
.gallery-title span {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--gray-mid);
  font-style: normal;
  margin-top: 4px;
}
.gallery-meta {
  text-align: right;
  font-size: 13px;
  color: var(--gray-mid);
}
.gallery-meta strong { color: var(--black); font-size: 22px; font-family: var(--sans); display: block; }

.orders-list { display: flex; flex-direction: column; gap: 40px; }
.order-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.order-label-text {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gray-mid);
}
.order-label-line { flex: 1; height: 1px; background: var(--gray-light); }
.order-date { font-size: 12px; color: var(--gray-light); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}
.photo-item {
  aspect-ratio: 3/2;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--gray-bg);
}
.photo-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease, opacity 0.2s;
}
.photo-item:hover img { transform: scale(1.03); }
.photo-overlay {
  position: absolute; inset: 0;
  background: rgba(26,26,26,0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.photo-item:hover .photo-overlay { background: rgba(26,26,26,0.15); }
.photo-num {
  position: absolute;
  bottom: 8px; left: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.download-bar {
  margin-top: 28px;
  padding: 16px 20px;
  background: var(--gray-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-dark);
}
.btn-outline {
  padding: 9px 20px;
  border: 1px solid var(--black);
  background: transparent;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--black);
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}
.btn-outline:hover { background: var(--black); color: var(--white); }
.download-expired { font-size: 12px; color: var(--gray-mid); letter-spacing: 0.4px; }

/* ── ROLL LIST ── */
.roll-filters {
  margin-bottom: 24px;
}
.filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-input {
  padding: 10px 14px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--black);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
  flex: 1;
  min-width: 160px;
}
.filter-input-sm { flex: 0 0 140px; min-width: 120px; }
.filter-input::placeholder { color: var(--gray-mid); }
.filter-input:focus { border-color: var(--black); }
.filter-btn { flex: 0 0 auto; width: auto; padding: 10px 20px; }

.roll-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.roll-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--white);
  transition: background 0.15s;
  position: relative;
  cursor: pointer;
}
.roll-card:not(:last-child) { border-bottom: 1px solid var(--gray-light); }
.roll-card:hover { background: var(--gray-bg); }
.roll-action { position: relative; z-index: 1; }

.roll-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-bg);
  border: 1px solid var(--gray-light);
}
.roll-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.roll-thumb-empty {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.roll-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.roll-info-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.roll-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roll-film {
  font-size: 13px;
  color: var(--gray-dark);
}
.roll-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-mid);
}
.roll-id { font-weight: 500; color: var(--gray-dark); }
.roll-dot { color: var(--gray-light); }

.roll-action { flex: 0 0 auto; }

.roll-empty {
  padding: 64px 0;
  text-align: center;
  color: var(--gray-mid);
  font-size: 14px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-lg);
}

/* ── ROLL DETAIL ── */
.roll-detail-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.back-link {
  font-size: 13px;
  color: var(--gray-mid);
  text-decoration: none;
  transition: color 0.15s;
}
.back-link:hover { color: var(--black); }
.roll-detail-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.roll-detail-title .roll-name { font-size: 28px; font-weight: 400; }
.roll-detail-title .roll-film { font-size: 15px; color: var(--gray-dark); }
.roll-detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--gray-mid);
  flex-wrap: wrap;
}
.btn-sm-inline {
  padding: 6px 14px;
  font-size: 12px;
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-light);
}
.page-btn {
  padding: 8px 18px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--black);
  text-decoration: none;
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--black); }
.page-btn-disabled {
  color: var(--gray-light);
  cursor: default;
  border-color: var(--gray-light);
}
.page-btn-disabled:hover { border-color: var(--gray-light); }
.page-info { font-size: 13px; color: var(--gray-mid); }

@media (max-width: 600px) {
  .roll-card { padding: 12px 16px; gap: 14px; }
  .roll-thumb { flex: 0 0 56px; width: 56px; height: 56px; }
  .filter-input { min-width: 100%; }
  .filter-input-sm { flex: 1; }
}

/* ── ADMIN ── */
.admin-wrap { padding: 40px 48px; max-width: 1280px; margin: 0 auto; width: 100%; }
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-light);
}
.admin-title { font-family: var(--sans); font-size: 30px; font-weight: 400; }
.btn-sm {
  padding: 9px 18px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-sm:hover { opacity: 0.8; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.stat-card {
  padding: 20px 24px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
}
.stat-num {
  font-family: var(--sans);
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--gray-mid); letter-spacing: 0.5px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}
.section-header .section-title { margin-bottom: 0; }
.section-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 16px;
}
.search-input {
  padding: 8px 14px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--black);
  outline: none;
  width: 280px;
  transition: border-color 0.15s;
}
.search-input::placeholder { color: var(--gray-mid); }
.search-input:focus { border-color: var(--black); }
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--gray-mid);
  padding: 0 16px 12px 16px;
  border-bottom: 1px solid var(--gray-light);
}
.users-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-bg);
  vertical-align: middle;
}
.users-table tr:hover td { background: var(--gray-bg); }
.user-name { font-weight: 500; }
.user-email { color: var(--gray-mid); font-size: 13px; }
.user-instagram { color: var(--gray-mid); font-size: 13px; }
.user-instagram.empty { color: var(--gray-light); }
.table-actions { display: flex; gap: 8px; }
.action-link {
  font-size: 12px;
  color: var(--gray-mid);
  cursor: pointer;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: all 0.15s;
}
.action-link:hover { color: var(--black); border-bottom-color: var(--black); }
.action-link.danger:hover { color: #c0392b; border-bottom-color: #c0392b; }

/* ── ADMIN USER DETAIL ── */
.admin-user-wrap { padding: 40px 48px; max-width: 1280px; margin: 0 auto; width: 100%; }
.breadcrumb {
  font-size: 13px;
  color: var(--gray-mid);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb a { color: var(--gray-mid); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { color: var(--black); }
.breadcrumb-sep { color: var(--gray-light); }

.user-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-light);
}
.user-detail-info h2 { font-family: var(--sans); font-size: 28px; font-weight: 400; margin-bottom: 4px; }
.user-detail-info p { font-size: 14px; color: var(--gray-mid); }
.user-detail-actions { display: flex; gap: 10px; align-items: center; }

/* ── ORDER BLOCKS ── */
.order-section {
  margin-bottom: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--gray-light);
}
.order-section:last-of-type { border-bottom: none; }
.order-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.order-header-info { flex: 1; }
.order-edit-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.order-edit-input {
  padding: 7px 10px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--black);
  outline: none;
  flex: 1;
  min-width: 120px;
}
.order-edit-input:focus { border-color: var(--black); }
.order-edit-input-sm { flex: 0 0 130px; }
.btn-outline-sm {
  padding: 7px 14px;
  border: 1px solid var(--gray-light);
  background: transparent;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--gray-dark);
  transition: all 0.15s;
}
.btn-outline-sm:hover { border-color: var(--black); color: var(--black); }
.order-header-title {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 2px;
}
.order-header-meta {
  font-size: 13px;
  color: var(--gray-mid);
}
.order-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.btn-upload {
  cursor: pointer;
  display: inline-block;
}
.btn-danger {
  border-color: #c0392b;
  color: #c0392b;
}
.btn-danger:hover {
  background: #c0392b;
  color: var(--white);
  border-color: #c0392b;
}
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-dark);
  font-size: 15px;
}

.upload-zone {
  border: 1.5px dashed var(--gray-light);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover,
.upload-zone.dragover { border-color: var(--black); background: var(--gray-bg); }
.upload-zone-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.3; }
.upload-zone-text { font-size: 14px; color: var(--gray-mid); }
.upload-zone-text strong { color: var(--black); font-weight: 500; }

.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.admin-photo-item {
  aspect-ratio: 3/2;
  overflow: hidden;
  position: relative;
  background: var(--gray-bg);
  cursor: pointer;
}
.admin-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.2s; }
.admin-photo-item:hover img { opacity: 0.7; }
.admin-photo-del {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--black);
  transition: background 0.15s;
}
.admin-photo-item:hover .admin-photo-del { display: flex; }
.admin-photo-del:hover { background: white; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-img { max-width: 90vw; max-height: 88vh; object-fit: contain; }
.modal-close {
  position: fixed; top: 20px; right: 24px;
  background: none; border: none;
  color: white; font-size: 28px; cursor: pointer;
  opacity: 0.7; line-height: 1;
}
.modal-close:hover { opacity: 1; }
.modal-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  background: none; border: none;
  color: white; font-size: 64px; cursor: pointer;
  opacity: 0.5; line-height: 1;
  padding: 0 20px;
  user-select: none;
  transition: opacity 0.15s;
}
.modal-nav:hover { opacity: 1; }
.modal-prev { left: 0; }
.modal-next { right: 0; }
.modal-counter {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* ── UPLOAD OVERLAY ── */
.upload-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.upload-overlay-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.upload-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-light);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.upload-overlay-title { font-size: 18px; font-weight: 500; }
.upload-overlay-sub { font-size: 13px; color: var(--gray-mid); }
.upload-progress-track {
  width: 100%;
  height: 4px;
  background: var(--gray-light);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--black);
  border-radius: 2px;
  transition: width 0.2s ease;
}
.upload-progress-text { font-size: 13px; color: var(--gray-mid); font-weight: 500; }
.upload-result-icon { font-size: 48px; line-height: 1; margin-bottom: 4px; }
.upload-elapsed { font-size: 22px; font-weight: 300; color: var(--gray-mid); letter-spacing: 1px; }
.admin-photo-dl {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.55);
  color: white; font-size: 13px;
  padding: 3px 8px; border-radius: 3px;
  text-decoration: none; opacity: 0;
  transition: opacity 0.15s;
}
.admin-photo-item:hover .admin-photo-dl { opacity: 1; }

/* ── FOOTER ── */
footer {
  padding: 40px 48px;
  border-top: 1px solid var(--gray-light);
  margin-top: 80px;
  background: var(--gray-bg);
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.footer-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  text-decoration: none;
  transition: opacity 0.15s;
}
.footer-link:hover { opacity: 0.7; }
.footer-social {
  display: flex;
  align-items: center;
  gap: 16px;
}
.footer-icon {
  color: var(--gray-dark);
  transition: color 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
}
.footer-icon:hover { color: var(--black); transform: translateY(-1px); }
.footer-info {
  font-size: 12px;
  color: var(--gray-mid);
}

/* ── NEW USER FORM ── */
.new-user-form-inner .field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.new-user-form-inner .field-row input {
  padding: 10px 14px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--black);
  outline: none;
  flex: 1;
}
.new-user-form-inner .field-row input:focus { border-color: var(--black); }

/* ── ADMIN TOOLS ── */
.admin-tools {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--gray-light);
}
.admin-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.admin-tool-card {
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.admin-tool-card h4 {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--black);
}
.tool-field {
  margin-bottom: 10px;
}
.tool-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 4px;
}
.tool-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--black);
  outline: none;
}
.tool-field input:focus { border-color: var(--black); }
.tool-hint {
  font-size: 12px;
  color: var(--gray-mid);
  margin-bottom: 12px;
  line-height: 1.4;
}
.tool-status {
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--gray-light);
}
.status-dot.active { background: #2ecc71; }

/* ── BADGES ── */
.badge-inactive {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  background: #f0e0e0;
  color: #c0392b;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}
/* ── PROFILE ── */
.profile-wrap { padding: 40px 48px; max-width: 600px; margin: 0 auto; width: 100%; }
.profile-title {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-light);
}
.profile-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  /* Nav */
  nav { padding: 20px 20px; }
  .logo-img { height: 32px; }
  .nav-right { gap: 14px; font-size: 12px; }
  .nav-badge { font-size: 10px; padding: 2px 6px; }

  /* Gallery */
  .gallery-wrap { padding: 24px 20px; }
  .gallery-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .gallery-meta { text-align: left; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; }
  .download-bar { flex-direction: column; gap: 12px; text-align: center; }

  /* Admin */
  .admin-wrap { padding: 24px 20px; }
  .admin-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .users-table { font-size: 13px; min-width: 600px; }
  .users-table th, .users-table td { padding: 10px 8px; }
  .users-table .col-instagram,
  .users-table .col-last-order { display: none; }

  /* Admin user detail */
  .admin-user-wrap { padding: 24px 20px; }
  .user-detail-header { flex-direction: column; gap: 16px; }
  .admin-tools-grid { grid-template-columns: 1fr; }
  .order-header { flex-direction: column; gap: 12px; }
  .order-header-actions { align-self: flex-start; }
  .admin-photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  /* Sessions */
  .session-card { padding: 12px 14px; }
  .session-rolls-table { min-width: 500px; }
  .session-add-roll .field-row { flex-direction: column; }
  .session-add-roll .field-row input,
  .session-add-roll .field-row select { width: 100%; max-width: none !important; }

  /* Upload zone */
  .upload-zone { padding: 16px; }

  /* Profile */
  .profile-wrap { padding: 24px 20px; }

  /* New user form */
  .new-user-form-inner .field-row { flex-direction: column; }
  .new-user-form-inner .field-row input { width: 100%; }

  /* Footer */
  footer { padding: 20px; flex-direction: column; gap: 4px; text-align: center; margin-top: 40px; }
}

@media (max-width: 480px) {
  nav { padding: 16px; }
  .logo-img { height: 28px; }
  .nav-right { gap: 10px; }

  .gallery-wrap { padding: 20px 16px; }
  .gallery-title { font-size: 24px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  .admin-wrap { padding: 20px 16px; }
  .admin-user-wrap { padding: 20px 16px; }
  .profile-wrap { padding: 20px 16px; }
  .profile-title { font-size: 24px; }

  .stats-row { grid-template-columns: 1fr; }
  .stat-num { font-size: 28px; }

  .admin-tool-card { padding: 16px; }
  .btn-sm { padding: 8px 14px; font-size: 12px; }
  .btn-outline { padding: 8px 14px; font-size: 12px; }
}

.badge-inactive-sm {
  font-size: 10px;
  font-weight: 500;
  color: #c0392b;
  margin-left: 6px;
  letter-spacing: 0.3px;
}

.download-expired {
  font-size: 13px;
  color: var(--gray-mid);
  font-style: italic;
}

.badge-purged {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--gray-mid);
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius);
  margin-left: 8px;
  letter-spacing: 0.3px;
  vertical-align: middle;
  cursor: help;
}

.badge-notified {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius);
  margin-left: 8px;
  letter-spacing: 0.3px;
  vertical-align: middle;
  cursor: help;
}

.btn-notify {
  background: #2ecc71 !important;
  color: #fff !important;
  border: none;
}
.btn-notify:hover { background: #27ae60 !important; }

.btn-notify-again {
  background: transparent !important;
  color: var(--gray-mid) !important;
  border: 1px solid var(--gray-light) !important;
}
.btn-notify-again:hover {
  color: var(--black) !important;
  border-color: var(--gray-mid) !important;
}

/* ── PENDING BADGES ── */
.status-dot.pending { background: #f39c12; }

.badge-pending {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  background: rgba(243, 156, 18, 0.12);
  color: #f39c12;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.badge-pending-sm {
  font-size: 10px;
  font-weight: 500;
  color: #f39c12;
  margin-left: 6px;
  letter-spacing: 0.3px;
}

.field-hint {
  font-size: 12px;
  color: var(--gray-mid);
  margin-top: 8px;
  line-height: 1.4;
}

/* ── LAB ── */
.capacity-bar {
  display: inline-block;
  width: 80px;
  height: 6px;
  background: var(--gray-bg);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.capacity-bar-lg {
  width: 100%;
  height: 10px;
  border-radius: 5px;
  margin-bottom: 8px;
}
.capacity-bar-fill {
  height: 100%;
  background: #2ecc71;
  border-radius: 3px;
  transition: width 0.3s;
}
.capacity-bar-fill[style*="width: 7"],
.capacity-bar-fill[style*="width: 8"] {
  background: #f39c12;
}
.capacity-bar-fill[style*="width: 9"],
.capacity-bar-fill[style*="width: 100"] {
  background: #c0392b;
}

.badge-process {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--black);
  background: var(--gray-bg);
  padding: 2px 8px;
  border-radius: var(--radius);
  letter-spacing: 0.5px;
}

.badge-exhausted {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  background: rgba(192, 57, 43, 0.1);
  color: #c0392b;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.badge-active-kit {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  background: rgba(46, 204, 113, 0.1);
  color: #2ecc71;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.badge-format {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-mid);
  background: var(--gray-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Sessions ── */
.session-card {
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.session-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.session-number {
  font-family: var(--serif);
  font-size: 18px;
}
.session-equivs,
.session-rolls-count {
  font-size: 12px;
  color: var(--gray-mid);
}
.session-times {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.time-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.time-label {
  font-size: 11px;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.time-value {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.time-theoretical {
  color: var(--gray-mid);
}
.time-real {
  color: var(--black);
}
.time-actual {
  color: #2ecc71;
}
.time-pending {
  color: var(--gray-light);
  font-weight: 400;
  font-style: italic;
  font-size: 13px;
}
.time-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.time-form input {
  padding: 6px 10px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
}
.btn-xs {
  padding: 4px 10px !important;
  font-size: 12px !important;
}
.session-rolls-table {
  margin: 8px 0;
  font-size: 13px;
}
.roll-input {
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 6px;
  font-family: var(--sans);
  font-size: 13px;
  border-radius: 3px;
  transition: border-color 0.15s;
  width: 100%;
}
.roll-input:hover,
.roll-input:focus {
  border-color: var(--gray-light);
  background: var(--white);
  outline: none;
}
.roll-input-num {
  width: 50px;
  text-align: center;
  -moz-appearance: textfield;
}
.roll-input-num::-webkit-outer-spin-button,
.roll-input-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.roll-input-film { min-width: 80px; }
.roll-input-notes { color: var(--gray-mid); min-width: 60px; }
.roll-input-user { max-width: 100px; font-size: 12px; }
.roll-client-cell { display: flex; gap: 4px; align-items: center; }
.roll-actions { display: flex; gap: 4px; align-items: center; }
.session-notes-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
}
.session-notes-form input {
  flex: 1;
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--gray-mid);
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent !important;
  transition: border-color 0.15s;
}
.session-notes-form input:hover,
.session-notes-form input:focus {
  border-color: var(--gray-light) !important;
  background: var(--white);
  outline: none;
}
.session-notes-form .btn-sm {
  opacity: 0;
  transition: opacity 0.15s;
}
.session-notes-form:hover .btn-sm,
.session-notes-form input:focus ~ .btn-sm {
  opacity: 1;
}
.session-add-roll {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-bg);
}

/* ── PHOTO EDITOR ── */

.edit-bar {
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.edit-bar-left { display: flex; gap: 8px; flex-wrap: wrap; }
.edit-count { font-size: 12px; color: var(--gray-mid); }

.btn-text {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--gray-dark);
  cursor: pointer;
  padding: 6px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-text:hover { color: var(--black); }

.select-toolbar {
  margin-bottom: 12px;
  padding: 10px 16px;
  background: var(--gray-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.select-count { font-size: 13px; color: var(--gray-dark); }
.select-actions { display: flex; align-items: center; gap: 8px; }
.select-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Grid tiles ------------------------------------------------------------ */

.photo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-edited-badge {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(26,26,26,0.65);
  padding: 2px 7px;
  border-radius: 2px;
  display: none;
}
.photo-item.is-edited .photo-edited-badge { display: block; }

.photo-edit-btn {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  border: none;
  border-radius: 2px;
  background: rgba(255,255,255,0.9);
  color: var(--black);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.photo-edit-btn:hover { background: var(--white); }
body.select-mode .photo-edit-btn { display: none; }
/* With a mouse the pencil appears on hover. */
@media (hover: hover) {
  .photo-item:hover .photo-edit-btn { opacity: 1; }
}
/* Without one (touch laptops, tablets) there is no hover to reveal it, so it
   stays visible rather than being unreachable. */
@media (hover: none) {
  .photo-edit-btn { opacity: 1; }
}
/* On phones it is dropped entirely — the tile is too small for a reliable tap
   target, so editing happens from the lightbox via .modal-edit-btn. Keyed to
   viewport width, not hover, because some desktop browsers report hover:none
   and would otherwise lose the pencil too. */
@media (max-width: 700px) {
  .photo-edit-btn { display: none; }
}

.photo-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 20px; height: 20px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: rgba(26,26,26,0.3);
  display: none;
}
body.select-mode .photo-check { display: block; }
.photo-item.is-selected .photo-check {
  background: #2ecc71;
  border-color: var(--white);
}
.photo-item.is-selected .photo-check::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 11px;
  line-height: 1;
}
.photo-item.is-selected { outline: 2px solid var(--black); outline-offset: -2px; }

/* Editor overlay -------------------------------------------------------- */

.editor-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(26,26,26,0.94);
  padding: 24px;
  align-items: center;
  justify-content: center;
}
.editor-overlay.open { display: flex; }
body.editor-open { overflow: hidden; }

.editor-box {
  width: 100%;
  max-width: 1400px;
  height: 100%;
  max-height: 900px;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 320px;
}

.editor-preview {
  position: relative;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 20px;
}
#editor-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.15s;
}
#editor-canvas.is-loading { opacity: 0.3; }

.editor-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 14px;
}
.editor-nav:hover { color: var(--white); }
.editor-prev { left: 4px; }
.editor-next { right: 4px; }

.editor-preview-meta {
  position: absolute;
  bottom: 12px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  pointer-events: none;
}

.editor-panel {
  border-left: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.editor-panel-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.editor-panel-title { font-size: 15px; font-weight: 500; }
.editor-scope { font-size: 12px; color: var(--gray-mid); margin-top: 2px; }
.editor-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--gray-mid);
  cursor: pointer;
}
.editor-close:hover { color: var(--black); }

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.editor-sliders { padding: 4px 20px 16px; }
.slider-row { margin-bottom: 14px; }
.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.slider-head label { font-size: 12px; color: var(--gray-dark); }
.slider-val {
  font-size: 11px;
  color: var(--gray-mid);
  font-variant-numeric: tabular-nums;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  /* The visible track stays a 2px hairline, but the control itself is tall
     enough to actually grab on a touchscreen. */
  height: 22px;
  background-color: transparent;
  background-image: linear-gradient(var(--gray-light), var(--gray-light));
  background-size: 100% 2px;
  background-position: center;
  background-repeat: no-repeat;
  outline: none;
  cursor: pointer;
  /* Vertical drags scroll the panel; only horizontal drags move the slider.
     Paired with the scroll guard in editor.js, which undoes the value jump a
     range input performs on touch-down. */
  touch-action: pan-y;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--black);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 13px; height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--black);
  cursor: pointer;
}

.editor-hint {
  padding: 0 20px 10px;
  font-size: 11px;
  color: var(--gray-mid);
  line-height: 1.5;
}
.editor-hint strong { font-weight: 500; color: var(--gray-dark); }

.editor-status {
  padding: 0 20px;
  font-size: 12px;
  color: var(--gray-mid);
  min-height: 18px;
}
.editor-status.ok { color: #2ecc71; }
.editor-status.err { color: #c0392b; }

.editor-actions {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--gray-light);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.editor-actions .btn-primary { margin-left: auto; width: auto; }

@media (max-width: 900px) {
  .editor-overlay { padding: 0; }
  .editor-box {
    max-height: none;
    grid-template-columns: 1fr;
    /* Was 45vh, which left the controls a ~150px porthole to scroll through. */
    grid-template-rows: minmax(150px, 34vh) 1fr;
    border-radius: 0;
  }
  .editor-panel { border-left: none; border-top: 1px solid var(--gray-light); }
  .editor-actions .btn-primary { margin-left: 0; flex: 1; }

  /* Reclaimed for the scroll area: the hint duplicates what the controls
     already show, and the action bar does not need to wrap onto three rows. */
  .editor-hint { display: none; }
  .editor-actions { padding: 10px 16px 12px; gap: 6px; }
  .editor-actions .btn-outline,
  .editor-actions .btn-text { padding: 8px 10px; font-size: 11px; }
  .editor-panel-head { padding: 12px 16px 10px; }
  .editor-mode { padding: 8px 16px 0; }
  .preset-section { padding: 12px 16px 10px; }
  .editor-sliders { padding: 4px 16px 12px; }

  /* Finger room between controls. */
  .slider-row { margin-bottom: 18px; }
}

/* ── EDITOR: MODES + PRESETS ── */

.editor-mode {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
}
.mode-btn {
  flex: 1;
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--gray-dark);
  background: var(--gray-bg);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mode-btn:hover { color: var(--black); }
.mode-btn.is-active {
  background: var(--white);
  color: var(--black);
  border-color: var(--black);
  font-weight: 500;
}

.preset-section { padding: 16px 20px 12px; }
.preset-head {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 8px;
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.preset-btn {
  border: 1px solid var(--gray-light);
  border-radius: 3px;
  background: var(--white);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.preset-btn:hover { border-color: var(--gray-mid); }
.preset-btn.is-active {
  border-color: var(--black);
  box-shadow: inset 0 0 0 1px var(--black);
}
.preset-thumb {
  width: 100%;
  height: 46px;
  object-fit: cover;
  display: block;
  background: var(--gray-bg);
}
.preset-name {
  font-family: var(--sans);
  font-size: 10px;
  line-height: 1.2;
  color: var(--gray-dark);
  padding: 5px 3px;
  text-align: center;
  /* Keeps "Blanco y negro" from stretching its tile taller than the rest. */
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preset-btn.is-active .preset-name { color: var(--black); font-weight: 500; }

.intensity-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-light);
}

/* Simple mode hides the advanced sliders but keeps their values in effect. */
.editor-panel.is-simple .slider-row.is-pro-only { display: none; }

/* ── ADMIN: CLIENT EDITS + DOWNLOAD STATS ── */

.admin-photo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.admin-photo-item:hover .admin-photo-canvas { opacity: 0.7; }

.admin-photo-edited {
  position: absolute;
  bottom: 6px; left: 6px; right: 6px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--white);
  background: rgba(26,26,26,0.72);
  padding: 3px 6px;
  border-radius: 2px;
  z-index: 2;
  /* Long readouts get clipped rather than covering the frame. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.order-dot { color: var(--gray-light); margin: 0 2px; }
.meta-edited { color: var(--gray-dark); }
.meta-downloaded { color: #2ecc71; }
.meta-nodownload { color: var(--gray-light); }

/* Lightbox editing entry point (added by static/editor.js on roll pages). */
.modal-actions {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}
.modal-edit-btn {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--black);
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 3px;
  padding: 9px 18px;
  cursor: pointer;
}
.modal-edit-btn:hover { background: var(--white); }
.modal-edited-tag {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.18);
  padding: 4px 8px;
  border-radius: 2px;
}

/* The counter sits where the actions now are, so lift it above them.
   The class is set by editor.js, so admin lightboxes are unaffected. */
.modal-overlay.has-actions .modal-counter { bottom: 68px; }

@media (max-width: 700px) {
  .modal-actions { bottom: 16px; }
  .modal-edit-btn { padding: 11px 22px; font-size: 14px; }
  /* Thumb-sized nav targets, clear of the action bar. */
  .modal-nav { font-size: 44px; padding: 0 12px; }
}

/* ── DETAILS: MONO LABELS ── */
.order-label-text, .section-title, .users-table th, .tool-field label,
.time-label, .preset-head, .photo-edited-badge, .modal-edited-tag,
.roll-thumb-empty, .roll-id, .photo-num, .modal-counter, .page-info,
.stat-label, .nav-badge, .error-code {
  font-family: var(--mono);
}
.roll-meta, .roll-detail-meta, .order-header-meta { font-variant-numeric: tabular-nums; }

/* ── MOTION ── */
.btn-primary, .btn-sm, .btn-outline, .btn-outline-sm, .page-btn {
  transition: opacity 0.18s var(--ease), background 0.18s var(--ease),
    color 0.18s var(--ease), border-color 0.18s var(--ease),
    transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn-primary:active, .btn-sm:active, .btn-outline:active,
.btn-outline-sm:active, .page-btn:not(.page-btn-disabled):active {
  transform: scale(0.98);
}
:is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}
.field input:focus-visible, .filter-input:focus-visible, .search-input:focus-visible,
.order-edit-input:focus-visible, .tool-field input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,26,26,0.08);
}

.roll-list, .stat-card, .admin-tool-card, .session-card {
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.roll-list:hover, .stat-card:hover, .session-card:hover { box-shadow: var(--shadow-card); }
.upload-overlay-box, .editor-box { box-shadow: var(--shadow-raised); }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoom {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}
.roll-card, .stat-card, .photo-item { animation: rise 0.35s var(--ease) backwards; }
.roll-card:nth-child(2), .stat-card:nth-child(2) { animation-delay: 0.03s; }
.roll-card:nth-child(3), .stat-card:nth-child(3) { animation-delay: 0.06s; }
.roll-card:nth-child(4), .stat-card:nth-child(4) { animation-delay: 0.09s; }
.roll-card:nth-child(5) { animation-delay: 0.12s; }
.roll-card:nth-child(n+6) { animation-delay: 0.15s; }
.photo-item { animation-name: fade; }
.modal-overlay.open { animation: fade 0.18s var(--ease); }
.modal-overlay.open .modal-img { animation: zoom 0.22s var(--ease); }
.upload-overlay { animation: fade 0.18s var(--ease); }
.upload-overlay-box { animation: zoom 0.22s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── QUESTIONS ON A PHOTO ── */
.photo-q-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--black);
  background: rgba(255,255,255,0.9);
  padding: 2px 7px;
  border-radius: 2px;
}
.photo-q-badge.is-answered { background: var(--green); color: var(--white); }

/* Sized over the lightbox image by questions.js. Inert unless a spot is being
   picked, so it never swallows clicks meant for the prev/next arrows. */
.q-layer { position: fixed; pointer-events: none; z-index: 1; }
.modal-overlay.is-asking .q-layer { pointer-events: auto; cursor: crosshair; }
.q-pin {
  position: absolute;
  width: 26px; height: 26px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--black);
  color: var(--white);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow-raised);
  transition: transform 0.18s var(--ease);
  animation: zoom 0.22s var(--ease);
}
button.q-pin:hover, .q-pin.is-open { transform: translate(-50%, -50%) scale(1.15); }
.q-pin.is-answered { background: var(--green); }
.q-pin.is-draft { background: var(--white); color: var(--black); border-color: var(--black); }
.q-hint {
  position: fixed;
  top: 24px; left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  color: var(--black);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
  z-index: 2;
  white-space: nowrap;
}
.q-panel {
  position: fixed;
  top: 72px; right: 24px;
  width: 320px;
  max-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  z-index: 3;
  box-shadow: var(--shadow-raised);
  animation: rise 0.22s var(--ease);
}
.q-panel-head { display: flex; align-items: center; justify-content: space-between; }
.q-panel-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
}
.q-panel-close {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  color: var(--gray-dark);
  cursor: pointer;
}
.q-msgs, .thread-msgs { display: flex; flex-direction: column; gap: 8px; }
.q-msgs { overflow-y: auto; min-height: 0; }
.q-msg, .msg {
  background: var(--gray-bg);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 92%;
  align-self: flex-start;
}
.q-msg p, .msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.q-msg.from-lab, .msg.from-lab { background: var(--black); color: var(--white); align-self: flex-end; }
.q-msg-who, .msg-who {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 3px;
}
.q-waiting { font-size: 12px; color: var(--gray-mid); }
.q-form { display: flex; flex-direction: column; gap: 8px; }
.q-form textarea, .thread-reply textarea, .saved-reply-form textarea,
.saved-reply-form input, .thread-saved {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--black);
  background: var(--white);
  outline: none;
  resize: vertical;
  transition: border-color 0.18s var(--ease);
}
.q-form textarea:focus, .thread-reply textarea:focus, .saved-reply-form textarea:focus,
.saved-reply-form input:focus, .thread-saved:focus { border-color: var(--black); }
.q-form .btn-primary { width: auto; align-self: flex-end; margin-top: 0; }
.q-error { font-size: 12px; color: var(--red); }
.q-error:empty { display: none; }

@media (max-width: 700px) {
  .q-panel {
    top: auto; right: 0; left: 0; bottom: 0;
    width: auto;
    max-height: 60vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .q-hint { white-space: normal; text-align: center; width: calc(100% - 48px); }
}

/* ── ADMIN: QUESTIONS INBOX ── */
.nav-count {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--red);
  color: var(--white);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}
.stat-sub { font-size: 12px; color: var(--gray-mid); margin-top: 8px; }
.inbox-tabs { display: flex; gap: 6px; }
.inbox-tab {
  padding: 7px 14px;
  border: 1px solid var(--gray-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--gray-dark);
  text-decoration: none;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.inbox-tab:hover { border-color: var(--black); color: var(--black); }
.inbox-tab.active { background: var(--black); border-color: var(--black); color: var(--white); }
.thread {
  display: flex;
  gap: 24px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-lg);
  animation: rise 0.35s var(--ease) backwards;
}
.thread.is-awaiting { border-color: var(--black); }
.thread-photo {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
  line-height: 0;
}
.thread-photo img { max-width: 260px; max-height: 260px; border-radius: var(--radius); display: block; }
.thread-photo .q-pin { cursor: default; animation: none; }
.thread-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--gray-mid);
}
.thread-meta a { color: var(--black); font-weight: 500; text-decoration: none; }
.thread-meta a:hover { text-decoration: underline; }
.badge-awaiting {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--black);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 20px;
}
.thread-reply { display: flex; flex-direction: column; gap: 8px; }
.thread-actions { display: flex; gap: 8px; }
.saved-replies { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--gray-light); }
.saved-reply {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-bg);
  font-size: 14px;
}
.saved-reply p { color: var(--gray-dark); white-space: pre-wrap; margin-top: 2px; }
.saved-reply-form { display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin-top: 20px; }
.saved-reply-form .btn-sm { align-self: flex-start; }

@media (max-width: 700px) {
  .thread { flex-direction: column; gap: 16px; padding: 16px; }
  .thread-photo img { max-width: 100%; }
}

/* ── ADMIN: BATCH UPLOAD ── */
.batch-panel { margin-bottom: 32px; animation: rise 0.3s var(--ease); }
.batch-list { display: flex; flex-direction: column; gap: 8px; }
.batch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
}
.batch-count, .batch-state { font-family: var(--mono); font-size: 12px; color: var(--gray-mid); white-space: nowrap; }
.batch-state { min-width: 90px; text-align: right; }
.batch-state.is-ok { color: var(--green); }
.batch-state.is-error { color: var(--red); white-space: normal; }
.batch-bar { flex: 0 0 120px; height: 4px; border-radius: 2px; background: var(--gray-bg); overflow: hidden; }
.batch-bar-fill { display: block; height: 100%; width: 0; background: var(--black); transition: width 0.2s var(--ease); }
.batch-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.batch-notify { font-size: 13px; color: var(--gray-dark); display: flex; align-items: center; gap: 8px; }
.batch-status { flex: 1; font-size: 13px; color: var(--gray-dark); }
