/* ===== LUXIE GALLERY — Clean Customer Experience CSS ===== */

/* Phông hệ thống (Sơn chọn 14/10/2026 trong 12 phông): SF trên iPhone/Mac, không tải phông ngoài. */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bg-primary: #fafafa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f5f5f5;
  --text-primary: #171717;
  --text-secondary: #525252;
  --text-muted: #707070;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --border: #e5e5e5;
  --border-light: #e5e5e5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --gap: 2px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --lightbox-action-bar-bottom: 88px;
  --lightbox-action-bar-height: 44px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.material-symbols-outlined {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  font-size: 24px;
  line-height: 1;
  vertical-align: middle;
}

.material-symbols-outlined svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Reserve glyph geometry while modules load, without flashing ligature text. */
.material-symbols-outlined:not([data-local-icon]) {
  visibility: hidden;
}

.rating-star.active .local-star,
.grid-star-badge .local-star {
  fill: currentColor;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  gap: 20px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ===== PASSWORD MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 24px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal-card h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.modal-card p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 24px; }

#password-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  margin-bottom: 16px;
}

#password-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-primary:hover { background: #1765cc; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  width: 100%;
  padding: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.btn-secondary:hover { background: var(--bg-surface-hover); border-color: #d4d4d4; }
.btn-secondary:active { transform: scale(0.98); }
.error-text { color: #d93025; font-size: 0.8125rem; margin-top: 12px; }

.album-save-modal-overlay {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 99999;
  overflow-y: auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.album-save-modal {
  max-width: 420px;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
}

.album-save-modal.is-builder-confirmation {
  max-width: 400px;
}

.album-save-modal.is-builder-confirmation p {
  overflow-wrap: anywhere;
}

.album-save-modal.is-builder-confirmation .album-save-actions > button {
  min-height: 44px;
}

.album-save-modal h2 {
  margin-bottom: 8px;
}

.album-save-modal.is-photo-share h2 {
  margin-bottom: 12px;
}

.album-save-modal p {
  margin-bottom: 16px;
}

.album-save-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.album-download-scope-list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.album-download-scope-choice {
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.album-download-scope-choice.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.album-download-scope-choice:disabled,
.album-download-scope-choice[aria-disabled="true"] {
  cursor: not-allowed;
  border-color: #fecaca;
  background: #fff7f7;
  color: #991b1b;
  opacity: 1;
}

.album-download-scope-choice:disabled .album-download-scope-choice-detail,
.album-download-scope-choice[aria-disabled="true"] .album-download-scope-choice-detail {
  color: #b91c1c;
}

.album-download-scope-choice:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.album-download-scope-choice-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.album-download-scope-choice-detail {
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.album-save-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

.album-save-row-text {
  min-width: 0;
}

.album-save-row-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.album-save-row-meta {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.album-save-row-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.album-save-row-badge-photos {
  background: #eff6ff;
  color: #1d4ed8;
}

.album-save-row-badge-zip {
  background: #f5f3ff;
  color: #6d28d9;
}

.album-save-row-badge-videos {
  background: #ecfeff;
  color: #0f766e;
}

.album-save-row-badge-ios-manual {
  background: #fff7ed;
  color: #c2410c;
}

.album-save-modal.is-photo-share .album-save-list {
  margin-bottom: 12px;
}

.album-save-modal.is-photo-share .album-save-row {
  align-items: baseline;
  padding: 0;
  border: 0;
  background: transparent;
}

.album-save-modal.is-photo-share .album-save-row-text {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 8px;
}

.album-save-modal.is-photo-share .album-save-row-label {
  font-size: 0.8125rem;
}

.album-save-modal.is-photo-share .album-save-row-meta {
  margin-top: 0;
}

.album-save-modal.is-photo-share .album-save-row-badge {
  display: none;
}

.album-video-zip-btn {
  width: 100%;
  margin: 0 0 12px;
}

.album-video-download-list {
  display: grid;
  gap: 10px;
  margin: -2px 0 16px;
  max-height: min(320px, 42vh);
  overflow-y: auto;
}

.album-video-download-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
}

.album-video-download-row.is-downloaded {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.album-video-download-text {
  min-width: 0;
}

.album-video-download-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  word-break: break-word;
}

.album-video-download-meta {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.album-video-download-btn {
  width: auto;
  min-width: 92px;
  padding: 10px 12px;
  justify-self: end;
}

.album-video-safari-note {
  margin: -2px 0 12px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: #1e3a8a;
}

.album-video-safari-note-title {
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.album-video-safari-note ol {
  margin: 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.album-video-safari-copy-btn {
  margin-bottom: 12px;
}

.album-save-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.album-save-modal.is-photo-share .album-save-actions {
  grid-template-columns: minmax(128px, 0.9fr) minmax(0, 1.1fr);
}

.album-save-modal.is-photo-share .album-save-actions > button {
  min-height: 44px;
  padding-inline: 10px;
  white-space: normal;
}

.album-save-modal.is-photo-share .btn-primary:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

.album-save-modal.is-photo-share .btn-secondary:disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

@media (max-width: 359px) {
  .album-save-modal.is-photo-share .album-save-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

.album-save-actions[hidden] {
  display: none;
}

.album-save-actions-single {
  grid-template-columns: minmax(0, 1fr);
  width: calc(50% - 5px);
  margin-inline: auto;
}

.album-save-modal.is-passive-progress .album-save-status {
  margin-bottom: 0;
}

.album-save-error {
  margin-bottom: 12px;
}

.album-save-status {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px 10px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
}

.album-save-status[hidden] {
  display: none;
}

.album-save-status[data-tone="success"] {
  background: #ecfdf5;
  color: #047857;
}

.album-save-modal.is-photo-share .album-save-status[data-tone="success"] {
  margin-bottom: 12px;
  padding-block: 10px;
}

.album-save-modal.is-photo-share .album-save-status {
  min-height: 72px;
}

.album-save-ios-guide {
  display: block;
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border-light);
}

.album-save-ios-guide[hidden] {
  display: none;
}

.album-save-ios-guide-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.album-save-ios-guide-title {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4;
}

.album-save-ios-guide-label {
  padding: 6px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.album-save-ios-guide-visual {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1179 / 452;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  background: #eef1f4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.album-save-ios-guide-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.album-save-ios-guide-image-context {
  opacity: 0.68;
  filter: blur(2.2px) saturate(0.76) brightness(1.02);
  transform: scale(1.018);
}

.album-save-ios-guide-image-focus {
  z-index: 2;
  /* Source bounds: x=330..592, y=32..408; leave breathing room around the icon and two-line label. */
  clip-path: inset(7.08% 49.79% 9.73% 27.99% round 20px);
  filter: saturate(0.98) contrast(1.03);
}

.album-save-ios-guide-image-label {
  position: absolute;
  z-index: 3;
  top: 60.62%;
  left: 27.99%;
  display: grid;
  place-items: center;
  width: 22.22%;
  height: 28.1%;
  box-sizing: border-box;
  padding: 2px 4px 4px;
  overflow: hidden;
  border-radius: 0 0 18px 18px;
  background: rgb(237, 238, 241);
  color: #0b0b0c;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: clamp(10px, 2.9vw, 11.5px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
  pointer-events: none;
}

.album-save-ios-guide-spotlight {
  position: absolute;
  z-index: 4;
  top: 7.08%;
  left: 27.99%;
  width: 22.22%;
  height: 83.19%;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 5px 18px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

@media (max-width: 359px) {
  .album-save-ios-guide-label {
    flex: 0 0 auto;
  }

  .album-save-ios-guide-visual {
    margin-top: 9px;
    border-radius: 14px;
  }
}

.album-save-status[data-tone="warning"] {
  background: #fff7ed;
  color: #c2410c;
}

.album-save-status[data-tone="error"] {
  background: #fef2f2;
  color: #b91c1c;
}

.album-save-status-icon {
  position: relative;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 0;
  font-size: 20px;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

.album-save-status-copy {
  min-width: 0;
}

.album-save-status-title {
  color: currentColor;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4;
}

.album-save-status-detail {
  margin-top: 3px;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 450;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.album-save-status-detail:empty {
  display: none;
}

.album-save-status-progress-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.album-save-status-progress-row[hidden] {
  display: none;
}

.album-save-status-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.2);
}

.album-save-status-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.album-save-status[data-spinning="true"] .album-save-status-icon {
  font-size: 0;
}

.album-save-status[data-spinning="true"] .album-save-status-icon::before,
.album-save-status[data-spinning="true"] .album-save-status-icon::after {
  content: "";
  position: absolute;
  inset: 1px;
  display: block;
  box-sizing: border-box;
  border-radius: 50%;
}

.album-save-status[data-spinning="true"] .album-save-status-icon::before {
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  animation: none;
}

.album-save-status[data-spinning="true"] .album-save-status-icon::after {
  border: 2px solid transparent;
  border-top-color: currentColor;
  animation: album-save-status-spin 0.9s linear infinite;
  transform-origin: 50% 50%;
  will-change: transform;
}

.album-save-status[data-indeterminate="true"] .album-save-status-progress-bar {
  animation: album-save-status-indeterminate 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes album-save-status-spin {
  to { transform: rotate(1turn); }
}

@keyframes album-save-status-indeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  .album-save-status[data-spinning="true"] .album-save-status-icon::after,
  .album-save-status[data-indeterminate="true"] .album-save-status-progress-bar {
    animation-duration: 2.4s;
  }
}

.album-save-status-progress-value {
  min-width: 3ch;
  color: currentColor;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

/* ===== ERROR SCREEN ===== */
.error-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  padding: 24px;
  text-align: center;
  gap: 12px;
}

.error-icon { margin-bottom: 8px; color: var(--text-muted); }
.error-icon .material-symbols-outlined { font-size: 48px; }
.error-screen h2 { font-size: 1.25rem; font-weight: 600; }
.error-screen p { color: var(--text-secondary); font-size: 0.875rem; }
/* Trang báo album đã lưu trữ: nút sang Luxie Lưu Trữ cho nhân sự đã đăng nhập (vừa chữ, không gạch chân). */
.error-screen .archive-viewer-link { width: auto; margin-top: 16px; padding: 12px 24px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.gallery-load-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px auto;
  padding: 0 16px;
}

.gallery-load-error .btn-primary {
  width: auto;
  min-height: 44px;
}

/* ===== TOP APP BAR ===== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.top-bar-title {
  font-size: clamp(1.34rem, 1.2rem + 0.45vw, 1.72rem);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-rendering: optimizeLegibility;
}

/* ===== BREADCRUMB NAVIGATION (Desktop) ===== */
.breadcrumb-nav {
  display: none; /* hidden on mobile */
  align-items: center;
  gap: 6px;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: -0.015em;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
}
.breadcrumb-nav.active {
  display: flex;
}
.breadcrumb-item {
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.breadcrumb-item:hover {
  color: var(--accent);
  background: var(--accent-light);
}
.breadcrumb-item.current {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: default;
  pointer-events: none;
}
.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.8125rem;
  flex-shrink: 0;
  user-select: none;
  transform: translateY(-0.5px);
}
/* Desktop: show breadcrumb, hide title when breadcrumb active */
@media (min-width: 768px) {
  .breadcrumb-nav.active ~ .top-bar-title,
  .top-bar-left:has(.breadcrumb-nav.active) > .top-bar-title {
    display: none;
  }
  .breadcrumb-nav.active {
    display: flex;
  }
}
/* Mobile: always show title, hide breadcrumb */
@media (max-width: 767px) {
  .breadcrumb-nav {
    display: none !important;
  }
}

/* ===== SEARCH BAR ===== */
.search-container {
  display: flex;
  align-items: center;
  position: relative;
}
.search-input {
  width: 0;
  opacity: 0;
  padding: 0;
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 8px;
  transition: width 0.22s ease, opacity 0.22s ease, padding 0.22s ease;
}
.search-container.active .search-input {
  width: 200px;
  opacity: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
}
.search-container.active .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.search-clear {
  width: 32px;
  height: 32px;
}
@media (max-width: 767px) {
  .search-container.active .search-input {
    width: 140px;
  }
  .search-container.active ~ .top-bar-meta {
    display: none;
  }
  .top-bar.search-mode .top-bar-title,
  .top-bar.search-mode #btn-bug-report,
  .top-bar.search-mode #btn-download-current-folder,
  .top-bar.search-mode #btn-upload,
  .top-bar.search-mode #btn-share,
  .top-bar.search-mode #btn-login,
  .top-bar.search-mode #user-avatar,
  .top-bar.search-mode .top-bar-meta,
  .top-bar.search-mode #btn-search {
    display: none !important;
  }
  .top-bar.search-mode .top-bar-left {
    flex: 0 0 auto;
    gap: 4px;
  }
  .top-bar.search-mode .top-bar-right {
    flex: 1;
    min-width: 0;
    gap: 0;
    justify-content: flex-end;
  }
  .top-bar.search-mode .search-container {
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
  }
  .top-bar.search-mode .search-container.active .search-input {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
}

/* Search highlight on album cards */
.album-card.search-hidden {
  display: none !important;
}
.grid-item.search-hidden {
  display: none !important;
}
.search-no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}
.search-no-results .material-symbols-outlined {
  font-size: 3rem;
  display: block;
  margin: 0 auto 0.5rem;
  opacity: 0.4;
}

.top-bar-right {
  flex-shrink: 0;
}

.top-bar-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--bg-surface-hover); }
}
.icon-btn .material-symbols-outlined { font-size: 24px; }

.download-current-folder-btn {
  width: auto;
  min-width: 44px;
  padding: 0 11px;
  gap: 5px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}

.download-current-folder-label {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

#btn-back {
  width: 36px;
  height: 36px;
  margin-left: 2px;
  margin-right: 2px;
  color: #5f5f5f;
}

#btn-back .material-symbols-outlined {
  font-size: 23px;
  font-variation-settings: 'FILL' 0, 'wght' 250, 'GRAD' 0, 'opsz' 24;
  transform: translateX(1.5px);
}

/* ===== ALBUM GRID ===== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.album-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.22, 0.9, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.22, 0.9, 0.3, 1),
              border-color var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.album-card-actions {
  position: static;
  display: flex;
  align-items: center;
  align-self: end;
  justify-self: end;
  gap: 6px;
  transform: none;
}

.album-card-share-btn,
.album-card-download-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(10px) saturate(1.05);
  color: rgba(64, 64, 64, 0.82);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

.grid-item-share-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(10px) saturate(1.05);
  color: rgba(64, 64, 64, 0.82);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
  z-index: 3;
}

.album-card-share-btn:hover,
.album-card-download-btn:hover,
.grid-item-share-btn:hover {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(255, 255, 255, 0.9);
  color: rgba(38, 38, 38, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.album-card-share-btn:active,
.album-card-download-btn:active,
.grid-item-share-btn:active {
  transform: scale(0.96);
}

.album-card-share-btn:disabled,
.album-card-download-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.album-card-download-btn {
  width: auto;
  min-width: 58px;
  padding: 0 9px;
  gap: 3px;
  background: #eff6ff;
  border-color: #dbeafe;
  color: #1d4ed8;
}

.album-card-download-btn .material-symbols-outlined {
  font-size: 18px;
}

.album-card-download-label {
  font-size: 0.7rem;
  font-weight: 700;
}

.album-card-share-btn .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

.grid-item-share-btn .material-symbols-outlined {
  font-size: 14.4px;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}

@keyframes share-button-pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(0.9);
  }
  72% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes share-icon-pop {
  0% {
    transform: scale(1) rotate(0deg);
  }
  40% {
    transform: scale(0.82) rotate(-8deg);
  }
  72% {
    transform: scale(1.12) rotate(6deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.share-feedback-active {
  animation: share-button-pop 320ms cubic-bezier(0.22, 0.9, 0.3, 1);
}

.icon-btn.share-feedback-active,
.lightbox-icon-btn.share-feedback-active {
  background: rgba(16, 185, 129, 0.12);
}

.album-card-share-btn.share-feedback-active,
.grid-item-share-btn.share-feedback-active {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.share-feedback-active .material-symbols-outlined {
  animation: share-icon-pop 320ms cubic-bezier(0.22, 0.9, 0.3, 1);
}

.album-card:hover { border-color: #d4d4d4; box-shadow: var(--shadow-sm); }
.album-card:active { transform: scale(0.98); }

.album-card-thumb {
  aspect-ratio: 4/3;
  width: 100%;
  object-fit: cover;
  background: var(--bg-primary);
  transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.album-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--surface) 100%);
}
.album-card-placeholder .placeholder-logo {
  width: 48px;
  height: auto;
  opacity: 0.25;
  object-fit: contain;
}

.album-card-info {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  min-height: 58px;
  padding: 11px 12px 12px;
}

.album-card-info.has-actions {
  padding-right: 12px;
}

.album-card-copy {
  min-width: 0;
}

.album-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.18;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.album-card-count {
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--text-muted);
}

@media (hover: hover) and (pointer: fine) {
  .album-card:hover {
    transform: translateY(-3px);
    border-color: #d4d4d4;
    box-shadow: 0 12px 28px rgba(23, 23, 23, 0.07), 0 3px 10px rgba(23, 23, 23, 0.05);
  }

  .album-card:hover .album-card-thumb {
    transform: scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .album-card,
  .album-card-thumb {
    transition: none;
  }

  .album-card:hover,
  .album-card:hover .album-card-thumb {
    transform: none;
  }
}

/* ===== EMPTY STATE & FOOTER ===== */
.empty-state { text-align: center; padding: 80px 24px; }
/* Biểu tượng là khối rộng 1em: căn giữa bằng margin auto (text-align không đẩy khối; 15/10 nằm lệch sát trái). */
.empty-icon { font-size: 48px; color: var(--text-muted); margin: 0 auto 20px; display: block; opacity: 0.5; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; }

.gallery-footer {
  text-align: center;
  padding: 32px 16px calc(var(--safe-bottom) + 32px);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gallery-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.gallery-footer a:hover { color: var(--accent); }

/* ===== PHOTO GRID — Clean 3 Column ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 24px 16px calc(var(--safe-bottom) + 16px);
  max-width: 1200px;
  margin: 0 auto;
}

.photo-grid-spacer {
  grid-column: 1 / -1;
  width: 100%;
  pointer-events: none;
}

.grid-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-primary);
  cursor: pointer;
  border-radius: 8px;
  /* Không dùng content-visibility (chế độ tự bỏ qua ô ngoài màn hình). Chrome bỏ qua cập nhật ô ngoài màn hình nên lớp chờ tải có lúc không được
     gỡ khi ảnh tải xong, đè lên ảnh tới khi rê chuột (Sơn gặp 15/10, album 523 ảnh: 156 ô đã tải vẫn còn lớp chờ).
     Album lớn đã có lưới ảo (PHOTO_GRID_VIRTUALIZE_THRESHOLD) nên không cần nó để nhẹ. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease; /* mờ dần khi tải xong: đo 15/10 không làm chậm cuộn, Sơn giữ */
  -webkit-touch-callout: none; /* Prevent long-press save (low quality) */
  pointer-events: none; /* Context menu targets div, not img */
}

.grid-item img.loading { opacity: 0; }
.grid-item img.loaded { opacity: 1; }
.grid-item:active img { transform: scale(0.96); }

.grid-item-filename {
  position: absolute;
  left: 50%;
  bottom: 7px;
  max-width: min(72%, calc(100% - 72px));
  transform: translateX(-50%);
  z-index: 2;
  padding: 3px 8px 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px) saturate(1.08);
  -webkit-backdrop-filter: blur(8px) saturate(1.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
  font-size: clamp(0.56rem, 0.48rem + 0.18vw, 0.68rem);
  font-weight: 560;
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Lấp lánh ở ô chờ tải, bản rẻ (Sơn 15/10): ô là nền tĩnh, chỉ một dải sáng trượt ngang bằng transform nên trình
   duyệt giao cho card đồ họa, không vẽ lại ô mỗi khung hình. Bản cũ dời background-position làm vẽ lại mọi ô đang
   chờ ở mỗi khung (đo: khung chậm nhất 9 → 17–33ms). Chỉ chạy ở ô đang trong màn hình (app.js gắn lớp
   grid-item-in-view): v348 cho cả ~160 ô chờ ngoài màn hình chạy, cuộn tụt còn 18–59 khung/giây. */
.grid-item::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 60%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, .55) 50%, transparent 100%);
  z-index: 0;
}

.grid-item.grid-item-in-view::before { animation: shimmer-sweep 1.5s linear infinite; }

.grid-item.loaded::before { display: none; }

@keyframes shimmer-sweep {
  from { transform: translateX(0); }
  to { transform: translateX(267%); }
}
@media (prefers-reduced-motion: reduce) {
  .grid-item.grid-item-in-view::before { animation: none; }
}

.grid-item.video-placeholder {
  background: #141414;
}

.grid-item.video-placeholder::after {
  content: 'play_circle';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'Material Symbols Outlined';
  font-size: 40px;
  color: rgba(255, 255, 255, 0.88);
  z-index: 1;
}

.grid-item-top-row {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
}

/* Video badge */
.grid-item .video-badge {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 2;
  text-transform: uppercase;
  pointer-events: none;
}

/* Responsive */
@media (min-width: 600px) {
  .photo-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 20px 16px 32px; }
  .album-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px 24px; }
  .top-bar { padding: calc(var(--safe-top) + 16px) 24px 16px; }
}

@media (min-width: 1024px) {
  .photo-grid { grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 20px 20px 48px; }
  .album-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-item:hover img { transform: scale(1.03); }
}

/* ===== LIGHTBOX — Immersive Photo Viewer ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: transparent;
  animation: lightbox-in 0.25s ease;
  -webkit-user-select: none;
  user-select: none;
  --lightbox-dismiss-overlay-opacity: 1;
  --lightbox-dismiss-transition-duration: 180ms;
  --lightbox-dismiss-transition-easing: cubic-bezier(0.22, 0.9, 0.3, 1);
}

.lightbox::before {
  content: '';
  position: absolute;
  inset: 0;
  /* Safari iPhone thu gọn thanh công cụ thì màn hình cao hơn khung cố định: nền trắng kéo dài xuống quá đáy để
     không lộ trang lưới phía sau khi dải ảnh nhỏ ẩn (clip Sơn 15/10/2026, giây 10–12). */
  bottom: -50vh;
  background: #fff;
  opacity: var(--lightbox-dismiss-overlay-opacity, 1);
  pointer-events: none;
  z-index: 0;
  will-change: opacity;
}

.lightbox.lightbox-opening-fallback::before {
  opacity: 0;
}

.lightbox.lightbox-opening-settle::before {
  transition: opacity 120ms ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Main image — fills ALL space above thumbnail strip */
.lightbox-container {
  --lightbox-page-gap: clamp(24px, 10vw, 40px);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(88px + var(--safe-bottom)); /* Space for thumbnail strip (64px thumbs + padding + safe area) */
  display: grid;
  grid-template-rows: 100%;
  grid-template-columns: 100%;
  place-items: center;
  touch-action: none;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
}

.lightbox.lightbox-dismiss-animating::before {
  transition: opacity var(--lightbox-dismiss-transition-duration, 180ms) linear;
}

.lightbox.lightbox-dismiss-animating .lightbox-container {
  transition: transform var(--lightbox-dismiss-transition-duration, 180ms) var(--lightbox-dismiss-transition-easing, cubic-bezier(0.22, 0.9, 0.3, 1));
}

.lightbox.lightbox-vertical-dismissing .lightbox-header,
.lightbox.lightbox-vertical-dismissing .action-bar,
.lightbox.lightbox-vertical-dismissing .lightbox-nav,
.lightbox.lightbox-vertical-dismissing .thumbnail-strip,
.lightbox.lightbox-vertical-dismissing .exif-panel {
  display: none !important;
}

.lightbox-img {
  /* CSS Grid stacking: both images share same grid cell, centered naturally */
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: default; /* Allow iOS long-press "Save to Photos" */
  transform-origin: center center;
  will-change: transform;
}

.lightbox-img-thumb {
  z-index: 1;
}

.lightbox-swipe-preview {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  display: none;
  pointer-events: none;
  /* Keep the incoming page above the old owning layer until that layer has
     decoded the same photo; otherwise a fast swipe ends with a visible hard cut. */
  z-index: 2;
  transform-origin: center center;
  will-change: transform;
}

.lightbox-swipe-preview.is-active {
  display: block;
}

/* When zoomed in, remove CSS size constraints so browser renders native pixels */
.lightbox-img.zoomed {
  max-width: none;
  max-height: none;
  object-fit: fill; /* Explicit dimensions set by JS, no re-constraining */
}

/* HighRes layer sits on top of thumbnail */
.lightbox-img-highres {
  z-index: 1;
  will-change: transform, opacity;
}

.lightbox-video {
  grid-area: 1 / 1;
  z-index: 2;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
  touch-action: manipulation;
}

.lightbox-container.has-video {
  cursor: default;
  touch-action: manipulation;
}

.lightbox.lightbox-video-mode::before {
  background: #000;
}

.lightbox.lightbox-video-mode .action-bar {
  display: none !important;
}

.lightbox.lightbox-video-mode .lightbox-header {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.34) 56%, transparent 100%);
}

.lightbox.lightbox-video-mode .lightbox-album-name,
.lightbox.lightbox-video-mode .lightbox-counter {
  color: rgba(255, 255, 255, 0.7);
}

.lightbox.lightbox-video-mode .lightbox-photo-name {
  color: #fff;
}

.lightbox.lightbox-video-mode #btn-close,
.lightbox.lightbox-video-mode #btn-lightbox-share,
.lightbox.lightbox-video-mode #btn-download {
  color: #fff;
}

.lightbox.lightbox-video-mode #btn-close:hover,
.lightbox.lightbox-video-mode #btn-lightbox-share:hover,
.lightbox.lightbox-video-mode #btn-download:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Top bar — auto-hide on tap */
.lightbox-header {
  --lightbox-ui-base-opacity: 1;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 6px) 8px 10px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
  opacity: var(--lightbox-ui-base-opacity, 1);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  will-change: opacity;
}

.lightbox-header.hidden {
  --lightbox-ui-base-opacity: 0;
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.lightbox-header-left,
.lightbox-header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Absolute center so it stays centered regardless of left/right widths */
.lightbox-header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--safe-top) + 6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.lightbox-album-name {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  text-align: center;
  letter-spacing: 0.02em;
}

.lightbox-photo-name {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  text-align: center;
}

.lightbox-counter {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ===== ACTION BAR — bottom floating controls ===== */
.action-bar {
  --lightbox-ui-base-opacity: 1;
  position: absolute;
  bottom: calc(var(--lightbox-action-bar-bottom) + var(--safe-bottom));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 15;
  padding: 4px 0;
  pointer-events: none;
  transform: translateY(0);
  opacity: var(--lightbox-ui-base-opacity, 1);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  will-change: opacity;
}

.action-bar.hidden {
  --lightbox-ui-base-opacity: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.action-bar > * {
  pointer-events: auto;
  min-width: 0;
}

.lightbox-rating {
  display: flex;
  align-items: center;
  gap: 1px;
  min-height: 36px;
  padding: 4px 10px 4px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  box-sizing: border-box;
}

.rating-star {
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 26px;
}

.rating-star .material-symbols-outlined {
  font-size: 22px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 22;
  color: #d4d4d4;
}

.rating-star.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 22;
  color: #404040;
}

.rating-clear {
  margin-right: 4px;
  border-right: 1px solid var(--border);
  padding-right: 8px;
}

.rating-clear .material-symbols-outlined {
  font-size: 20px;
  color: var(--text-muted) !important;
  opacity: 0.6;
}

.rating-star:hover {
  transform: scale(1.15);
}

.rating-star:active {
  transform: scale(0.9);
}

/* ===== FILTER BAR — Photo Mechanic compact style ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 5px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.filter-bar-label {
  font-size: 0.675rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px;
  white-space: nowrap;
}

.filter-sync-status {
  display: none;
  align-items: center;
  min-height: 24px;
  padding: 0 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.filter-bar.ratings-loading .filter-sync-status {
  display: inline-flex;
}

.filter-bar.ratings-loading .filter-bar-label,
.filter-bar.ratings-loading .filter-chip,
.filter-bar.ratings-loading .filter-download-btn {
  display: none;
}

.filter-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 5px;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
  color: var(--text-secondary);
}

.filter-chip:hover {
  background: var(--bg-surface-hover);
}

.filter-chip:active {
  transform: scale(0.9);
}

.filter-chip:not(.active) {
  opacity: 0.3;
  color: #d4d4d4;
}

.filter-download-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  padding: 0 10px 0 12px;
  height: 24px;
  border-radius: 0 5px 5px 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.filter-download-btn-text {
  display: inline;
}

.filter-download-btn-icon {
  display: none;
  font-size: 17px;
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 20;
}

.filter-download-btn-count {
  display: none;
}

.filter-download-btn:hover:not(:disabled) {
  color: var(--accent);
}

.filter-download-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.filter-download-btn:disabled {
  opacity: 0.45;
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Grow vertically into empty space; adjacent compact controls never overlap. */
.rating-star::after,
.filter-chip::after,
.filter-download-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: max(100%, 44px);
  transform: translateY(-50%);
}

.grid-item:focus-visible,
.album-card:focus-visible,
.thumb-item:focus-visible,
.rating-star:focus-visible,
.filter-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Grid star badge */
.grid-star-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.625rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.grid-star-badge .material-symbols-outlined {
  font-size: 10px;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* Trash badge for deleted files — matches star badge style */
.grid-trash-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 4px;
  border-radius: 4px;
  z-index: 3;
  pointer-events: none;
  line-height: 1;
}

.grid-trash-badge .material-symbols-outlined {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

.thumb-trash-badge {
  position: absolute;
  bottom: 1px;
  right: 2px;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 3px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 3;
  line-height: 1;
}

.thumb-trash-badge .material-symbols-outlined {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

/* ===== MULTI-SELECT (Photo Mechanic style) ===== */
.grid-item.selected {
  outline: 3px solid #1a73e8;
  outline-offset: -3px;
  z-index: 1;
}

.grid-item.selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  background: #1a73e8;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  pointer-events: none;
}

#selection-bar {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 20px;
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  color: white;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  z-index: 200;
  animation: selbar-in 0.25s ease;
  user-select: none;
  white-space: nowrap;
}

@keyframes selbar-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.sel-count {
  color: rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums;
}

.sel-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.2);
}

.sel-rate-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

.sel-rates {
  display: flex;
  gap: 2px;
}

.sel-rate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.sel-rate:hover {
  background: rgba(255,255,255,0.15);
}

.sel-rate:active {
  transform: scale(0.9);
}

.sel-rate[data-r="0"] {
  color: rgba(255,255,255,0.5);
  font-size: 0.875rem;
}

.sel-clear {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sel-clear:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

@media (max-width: 600px) {
  #selection-bar {
    left: 8px;
    right: 8px;
    transform: none;
    border-radius: 14px;
    gap: 8px;
    padding: 8px 12px 8px 16px;
    font-size: 0.75rem;
    justify-content: space-between;
  }
  @keyframes selbar-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .sel-rate-label { display: none; }
  .sel-rate { min-width: 26px; height: 26px; }
}

/* Thumbnail strip: dim filtered-out thumbs */
.thumb-item.filtered-out {
  opacity: 0.15 !important;
  pointer-events: none;
}

/* Thumbnail star badge */
.thumb-star-badge {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5625rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 600px) {
  .lightbox-photo-name { max-width: 300px; font-size: 0.875rem; }
  .lightbox-counter { font-size: 0.75rem; }
}

@media (min-width: 1024px) {
  .lightbox-photo-name { max-width: 500px; font-size: 0.9375rem; }
}

.lightbox-icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.lightbox-icon-btn:hover { background: rgba(0, 0, 0, 0.05); }
.lightbox-icon-btn .material-symbols-outlined { font-size: 24px; }

.diagnostic-report-btn {
  position: relative;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.diagnostic-report-btn .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.diagnostic-report-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.diagnostic-report-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

.diagnostic-report-btn:active {
  transform: scale(0.94);
}

.diagnostic-report-btn[data-dock="gallery-header"],
.diagnostic-report-btn[data-dock="lightbox"] {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.diagnostic-report-btn.is-sending {
  cursor: wait;
  color: #9f2d24;
}

.diagnostic-report-btn:disabled {
  opacity: 0.62;
}

.diagnostic-report-btn.is-sending .material-symbols-outlined {
  animation: current-photo-download-spin 0.8s linear infinite;
}

@media (hover: hover) {
  .diagnostic-report-btn:hover {
    color: #9f2d24;
    background: #f8efee;
  }
}

body.diagnostic-report-open {
  overflow: hidden;
}

.diagnostic-report-dialog {
  position: fixed;
  inset: 0;
  z-index: 100020;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  background: rgba(18, 18, 20, 0.38);
}

.diagnostic-report-dialog[hidden] {
  display: none;
}

.diagnostic-report-panel {
  width: min(460px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
}

.diagnostic-report-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.diagnostic-report-heading h2 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.3;
  font-weight: 700;
}

.diagnostic-report-heading p {
  margin: 5px 0 0;
  max-width: 38ch;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.diagnostic-report-close {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.diagnostic-report-close:hover {
  background: #f4f4f5;
  color: var(--text-primary);
}

.diagnostic-report-close .material-symbols-outlined {
  font-size: 20px;
}

.diagnostic-report-field {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.diagnostic-report-field > span {
  font-size: 0.75rem;
  line-height: 1.3;
  font-weight: 650;
  color: var(--text-primary);
}

.diagnostic-report-field textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  background: #fff;
  color: var(--text-primary);
  font: 400 0.9375rem/1.5 var(--font-ui);
}

.diagnostic-report-field textarea::placeholder {
  color: #707078;
}

.diagnostic-report-field textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: #6b8fd8;
}

.diagnostic-report-hint,
.diagnostic-report-error {
  margin: 9px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
}

.diagnostic-report-hint {
  color: var(--text-muted);
}

.diagnostic-report-error {
  color: #9f2d24;
  font-weight: 600;
}

.diagnostic-report-error[hidden] {
  display: none;
}

.diagnostic-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.diagnostic-report-actions button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  font: 650 0.8125rem/1 var(--font-ui);
  cursor: pointer;
}

.diagnostic-report-cancel {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  color: var(--text-secondary);
}

.diagnostic-report-submit {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #262629;
  color: #fff;
}

.diagnostic-report-submit .material-symbols-outlined {
  font-size: 17px;
}

.diagnostic-report-actions button:focus-visible,
.diagnostic-report-close:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.diagnostic-report-actions button:disabled,
.diagnostic-report-close:disabled,
.diagnostic-report-field textarea:disabled {
  cursor: wait;
  opacity: 0.62;
}

.diagnostic-report-submit:disabled .material-symbols-outlined {
  animation: current-photo-download-spin 0.8s linear infinite;
}

@media (max-width: 599px) {
  .diagnostic-report-dialog {
    place-items: end center;
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }

  .diagnostic-report-panel {
    width: 100%;
    max-height: min(82dvh, 720px);
    padding: 18px;
  }

  .diagnostic-report-field textarea {
    font-size: 1rem;
  }
}

#btn-download.is-preparing {
  cursor: wait;
  opacity: 0.72;
}

#btn-download.is-preparing .material-symbols-outlined {
  animation: current-photo-download-spin 0.8s linear infinite;
}

#btn-download.is-ready {
  color: var(--accent);
  background: var(--accent-light);
}

@keyframes current-photo-download-spin {
  to { transform: rotate(1turn); }
}

@media (prefers-reduced-motion: reduce) {
  #btn-download.is-preparing .material-symbols-outlined,
  .diagnostic-report-btn.is-sending .material-symbols-outlined,
  .diagnostic-report-submit:disabled .material-symbols-outlined { animation: none; }
}

/* Nav arrows — desktop only */
.lightbox-nav {
  --lightbox-ui-base-opacity: 1;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  z-index: 15;
  opacity: var(--lightbox-ui-base-opacity, 1);
  transition: background var(--transition-fast), opacity var(--transition-normal);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: var(--shadow-sm);
  will-change: opacity;
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-nav .material-symbols-outlined { font-size: 32px; }

.lightbox-nav.hidden { --lightbox-ui-base-opacity: 0; opacity: 0; pointer-events: none; }

.lightbox.lightbox-video-mode .lightbox-nav {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: none;
}

.video-controls {
  --video-preview-width: min(240px, calc(100vw - 40px));
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 94px);
  z-index: 18;
  display: none;
  padding: 0 18px 14px;
  color: #fff;
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  will-change: opacity, transform;
}

.lightbox.lightbox-video-mode .video-controls {
  display: block;
}

.video-controls.hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.video-seek {
  position: relative;
  width: 100%;
  padding: 16px 0 14px;
  cursor: pointer;
  touch-action: none;
}

.video-seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: visible;
}

.video-seek-buffer,
.video-seek-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  pointer-events: none;
}

.video-seek-buffer {
  background: rgba(255, 255, 255, 0.28);
}

.video-seek-progress {
  background: #fff;
}

.video-seek-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.26);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.26);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.video-seek-preview {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: var(--video-preview-width);
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(9, 9, 11, 0.92);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  transform: translateX(-50%);
  opacity: 1;
  transition: opacity 0.12s ease;
}

.video-seek-preview.hidden {
  opacity: 0;
}

.video-seek-preview-image {
  display: block;
  width: 100%;
  aspect-ratio: var(--video-preview-image-aspect-ratio, 16 / 9);
  border-radius: 8px;
  object-fit: cover;
  background: #000;
}

.video-seek-preview-time {
  display: block;
  margin-top: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.video-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-control-btn {
  color: #fff;
  background: rgba(0, 0, 0, 0.34);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.video-control-btn:hover {
  background: rgba(0, 0, 0, 0.52);
}

.video-time {
  min-width: 96px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.96);
  font-variant-numeric: tabular-nums;
}

.video-controls-spacer {
  flex: 1 1 auto;
}

@media (min-width: 768px) {
  .lightbox-nav { display: flex; }
  .lightbox-nav:hover { background: rgba(255, 255, 255, 0.9); }
  .lightbox.lightbox-video-mode .lightbox-nav:hover { background: rgba(0, 0, 0, 0.62); }
}

/* ===== THUMBNAIL STRIP ===== */
.thumbnail-strip {
  --lightbox-ui-base-opacity: 1;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 50%, transparent 100%);
  padding: 10px 0 calc(var(--safe-bottom) + 10px);
  opacity: var(--lightbox-ui-base-opacity, 1);
  transition: opacity var(--transition-normal);
  will-change: opacity;
}

.lightbox.lightbox-video-mode .thumbnail-strip {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.84) 0%, rgba(0, 0, 0, 0.46) 56%, transparent 100%);
}

.lightbox.video-fullscreen-active .lightbox-container {
  bottom: 0;
}

.lightbox.video-fullscreen-active .thumbnail-strip {
  display: none !important;
}

.lightbox.video-fullscreen-active .video-controls {
  bottom: calc(var(--safe-bottom) + 18px);
}

.thumbnail-strip.hidden {
  --lightbox-ui-base-opacity: 0;
  opacity: 0;
  pointer-events: none;
}

.thumbnail-strip-inner {
  --thumb-item-size: 64px;
  --thumb-item-gap: 3px;
  --thumb-strip-padding-inline: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.thumbnail-strip-track {
  display: flex;
  gap: var(--thumb-item-gap);
  width: max-content;
  min-width: 100%;
  padding: 0 var(--thumb-strip-padding-inline);
  transform: translate3d(0, 0, 0);
  transform-origin: left center;
  will-change: transform;
  /* 'safe center' falls back to 'start' when content overflows.
     Chrome/Chromium with plain 'center' pushes overflow into unreachable negative scroll. */
  justify-content: safe center;
}

.thumbnail-strip-inner.is-virtualized .thumbnail-strip-track {
  justify-content: flex-start;
}

.thumbnail-strip-inner::-webkit-scrollbar { display: none; }

.thumb-spacer {
  flex: 0 0 auto;
  height: 1px;
  pointer-events: none;
}

.thumb-item {
  position: relative;
  flex-shrink: 0;
  width: var(--thumb-item-size);
  height: var(--thumb-item-size);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: opacity var(--transition-fast), box-shadow var(--transition-fast);
  opacity: 1;
  background: var(--bg-primary);
}

.thumb-item:hover { opacity: 1; }

.thumb-item.video-placeholder {
  background: #141414;
}

.thumb-item.video-placeholder::after {
  content: 'play_circle';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'Material Symbols Outlined';
  font-size: 28px;
  color: rgba(255, 255, 255, 0.88);
  z-index: 1;
}

.thumb-item.active {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.thumb-item.selected {
  border-color: #22c55e;
  outline: 2px solid #22c55e;
  outline-offset: -2px;
}

.thumb-item.selected.active {
  border-color: var(--accent);
  outline: 3px solid #22c55e;
  outline-offset: 0px;
}

.thumb-item.selected::after {
  content: '✓';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #22c55e;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  z-index: 5;
  pointer-events: none;
}

@media (max-width: 767px) {
  .video-controls {
    bottom: calc(var(--safe-bottom) + 86px);
    padding: 0 12px 10px;
  }

  .video-time {
    min-width: 82px;
    font-size: 0.8125rem;
  }

  .video-seek-preview {
    width: min(200px, calc(100vw - 28px));
  }
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-touch-callout: none; /* Prevent long-press save (low quality) */
}

/* Desktop: larger thumbnails */
@media (min-width: 768px) {
  .lightbox-container { bottom: calc(104px + var(--safe-bottom)); } /* 80px thumbs + padding + safe area */
  .thumbnail-strip-inner { --thumb-item-size: 80px; --thumb-item-gap: 4px; }
  .thumb-item { border-radius: 5px; }
  .thumb-star-badge { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; bottom: 2px; }
}

/* ===== EXIF INFO PANEL ===== */
.exif-panel {
  --lightbox-ui-base-opacity: 0;
  position: absolute;
  bottom: calc(130px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 18;
  min-width: 160px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 6px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  opacity: var(--lightbox-ui-base-opacity, 1);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  will-change: opacity;
}

.exif-panel.open {
  --lightbox-ui-base-opacity: 1;
  opacity: var(--lightbox-ui-base-opacity, 1);
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.exif-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 1px 0;
  font-size: 0.6875rem;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
}

.exif-row.exif-camera {
  font-weight: 600;
  font-size: 0.75rem;
}

.exif-row.exif-lens {
  color: var(--text-secondary);
  font-size: 0.625rem;
}

.exif-icon {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exif-icon .material-symbols-outlined {
  font-size: 14px;
  color: #737373;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

/* Info button active state */
.lightbox-icon-btn.active {
  background: var(--accent-light);
  color: var(--accent);
}

/* Desktop: center bottom controls above larger thumbnails */
@media (min-width: 768px) {
  :root {
    --lightbox-action-bar-bottom: 118px;
  }

  .action-bar {
    left: 50%;
    right: auto;
    justify-content: center;
    padding: 4px 12px;
    transform: translateX(-50%);
  }

  .action-bar.hidden {
    transform: translateX(-50%) translateY(-10px);
  }

  .exif-panel {
    bottom: calc(160px + var(--safe-bottom));
  }
}

@media (max-width: 767px) {
  .action-bar {
    left: 6px;
    right: 6px;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
  }

  .lightbox-rating {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 36px;
    justify-content: flex-start;
    gap: 0;
    padding: 4px 9px 4px 6px;
    box-sizing: border-box;
  }

  .rating-star {
    min-width: 26px;
    min-height: 26px;
  }

  .rating-clear {
    margin-right: 2px;
    padding-right: 6px;
  }

  .filter-bar-label {
    display: none;
  }

  .filter-bar {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 36px;
    padding: 4px 6px;
    box-sizing: border-box;
  }

  .filter-chip {
    flex: 1 1 0;
    min-width: 24px;
    height: 24px;
    padding: 0 4px;
    font-size: 0.8125rem;
  }

  .filter-download-btn {
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    min-height: 24px;
    margin-left: 2px;
    padding: 0;
    border-radius: 0 6px 6px 0;
  }

  .filter-download-btn-text {
    display: none;
  }

  .filter-download-btn-icon,
  .filter-download-btn-count {
    display: flex;
  }

  .filter-download-btn-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--text-primary);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 0; height: 0; }

/* ===== TOP BAR RIGHT ===== */
.top-bar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(24px) scale(0.95);
  background: #171717;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-ui);
  letter-spacing: -0.01em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.35s;
  pointer-events: none;
  width: fit-content;
  max-width: min(560px, calc(100vw - 24px));
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}
.toast .toast-icon {
  display: flex;
  align-items: center;
  margin-top: 1px;
}
.toast .toast-icon .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.toast.toast-success .toast-icon .material-symbols-outlined {
  color: #4ade80;
}
.toast.toast-info .toast-icon .material-symbols-outlined {
  color: #60a5fa;
}
.toast.toast-warning .toast-icon .material-symbols-outlined {
  color: #fbbf24;
}
.toast.toast-error .toast-icon .material-symbols-outlined {
  color: #f87171;
}

.toast-message {
  min-width: 0;
  white-space: pre-line;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ===== PREPARED ZIP LIVE STATUS ===== */
.prepared-zip-live-status {
  --zip-live-accent: #60a5fa;
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 18px);
  z-index: 9100;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  width: min(520px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 12px;
  background: #171717;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transform: translateX(-50%);
  transition:
    opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.24s;
}

.prepared-zip-live-status[hidden] {
  display: none;
}

.prepared-zip-live-status[data-tone="success"] {
  --zip-live-accent: #4ade80;
}

.prepared-zip-live-status[data-tone="warning"] {
  --zip-live-accent: #fbbf24;
}

.prepared-zip-live-status[data-tone="error"] {
  --zip-live-accent: #f87171;
}

.prepared-zip-live-icon {
  align-self: start;
  margin-top: 1px;
  color: var(--zip-live-accent);
  font-size: 20px;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

.prepared-zip-live-copy {
  min-width: 0;
}

.prepared-zip-live-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.prepared-zip-live-heading strong {
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.prepared-zip-live-progress-value {
  flex: 0 0 auto;
  min-width: 3.5ch;
  color: var(--zip-live-accent);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: end;
}

.prepared-zip-live-progress-value[hidden] {
  display: none;
}

.prepared-zip-live-progress {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.prepared-zip-live-progress[hidden] {
  display: none;
}

.prepared-zip-live-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--zip-live-accent);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.prepared-zip-live-progress[data-indeterminate="true"] .prepared-zip-live-progress-bar {
  animation: prepared-zip-live-indeterminate 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.prepared-zip-live-detail {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.75rem;
  font-weight: 450;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.prepared-zip-live-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: #fff;
  color: #171717;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.prepared-zip-live-download[hidden] {
  display: none;
}

.prepared-zip-live-download .material-symbols-outlined {
  font-size: 17px;
}

.prepared-zip-live-download:hover {
  background: #f5f5f5;
}

.prepared-zip-live-download:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--zip-live-accent) 70%, white);
  outline-offset: 2px;
}

body.has-prepared-zip-live-status:not(.lightbox-open) .toast {
  bottom: calc(var(--safe-bottom) + 116px);
}

body.lightbox-open .prepared-zip-live-status {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
}

@keyframes prepared-zip-live-indeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}

@media (max-width: 599px) {
  .prepared-zip-live-status {
    bottom: calc(var(--safe-bottom) + 8px);
    width: calc(100vw - 16px);
    gap: 7px 10px;
    padding: 11px 12px;
  }

  .prepared-zip-live-download {
    min-height: 44px;
  }

  body.has-prepared-zip-live-status:not(.lightbox-open) .toast {
    bottom: calc(var(--safe-bottom) + 112px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .prepared-zip-live-status,
  .prepared-zip-live-progress-bar {
    transition-duration: 0.01ms;
  }

  .prepared-zip-live-progress[data-indeterminate="true"] .prepared-zip-live-progress-bar {
    animation-duration: 2.4s;
  }
}

/* ===== SYNC STATUS ===== */
.sync-status-widget {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--safe-bottom) + 18px);
  z-index: 9000;
  width: 420px;
  max-width: calc(100vw - 36px);
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.sync-status-widget.is-expanded {
  width: min(1500px, calc(100vw - 36px));
}

.sync-status-widget.is-icon {
  box-sizing: border-box;
  width: 46px;
  height: 46px;
  max-width: 46px;
  padding: 5px;
  border-radius: 999px;
}

.sync-status-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-status-widget.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.sync-status-icon {
  width: 30px;
  height: 30px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #f4f4f5;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sync-status-icon:hover {
  background: #ececee;
  color: var(--text-primary);
}

.sync-status-icon .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.sync-status-widget:not(.is-icon)[data-phase="running"] .sync-status-icon .material-symbols-outlined {
  animation: sync-status-spin 1.2s linear infinite;
}

.sync-status-widget[data-phase="running"] .sync-status-icon,
.sync-status-widget[data-phase="queued"] .sync-status-icon,
.sync-status-widget[data-phase="waiting"] .sync-status-icon {
  background: #f5f5f5;
  color: #444;
}

.sync-status-widget[data-phase="done"] .sync-status-icon {
  background: #f3f6f3;
  color: #3f7a4b;
}

.sync-status-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.sync-status-collapse-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sync-status-collapse-button:hover {
  background: #f4f4f5;
  color: var(--text-primary);
}

.sync-status-collapse-button .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.sync-status-widget.is-icon .sync-status-main {
  width: 100%;
  height: 100%;
  justify-content: center;
  gap: 0;
}

.sync-status-widget.is-icon .sync-status-icon {
  width: 34px;
  height: 34px;
}

.sync-status-widget.is-icon .sync-status-copy,
.sync-status-widget.is-icon .sync-status-collapse-button,
.sync-status-widget.is-icon .sync-status-rows,
.sync-status-widget.is-icon .sync-status-expanded-panel {
  display: none;
}

.sync-status-icon:disabled {
  cursor: default;
}

.sync-status-icon:disabled:hover {
  background: #f3f6f3;
  color: #3f7a4b;
}

.sync-status-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sync-status-title {
  font-size: 0.8125rem;
  line-height: 1.25;
  font-weight: 600;
  color: var(--text-primary);
}

.sync-status-rows {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  display: grid;
  gap: 6px;
}

.sync-status-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  font-size: 0.71875rem;
  line-height: 1.35;
}

.sync-status-row[hidden] {
  display: none;
}

.sync-status-row span {
  color: var(--text-muted);
  font-weight: 500;
}

.sync-status-row-value {
  min-width: 0;
  color: var(--text-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-status-row[data-sync-row="target"] .sync-status-row-value {
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  scrollbar-width: thin;
}

.sync-status-row[data-sync-row="target"] .sync-status-row-value::-webkit-scrollbar {
  height: 4px;
}

.sync-status-row[data-sync-row="target"] {
  align-items: start;
}

.sync-status-row[data-sync-row="target"] .sync-status-row-value {
  max-height: min(20vh, 132px);
  overflow: auto;
  white-space: pre;
  line-height: 1.45;
}

.sync-status-widget.is-expanded .sync-status-row[data-sync-row="target"] .sync-status-row-value {
  max-height: min(26vh, 220px);
  overflow: auto;
  white-space: pre;
  line-height: 1.45;
}

.sync-status-expanded-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.sync-status-full-content {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.sync-status-diagnostic-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 2px;
  font-size: 0.71875rem;
  line-height: 1.35;
}

.sync-status-diagnostic-row[hidden] {
  display: none;
}

.sync-status-diagnostic-row span {
  color: var(--text-muted);
  font-weight: 500;
}

.sync-status-diagnostic-row strong {
  min-width: 0;
  color: var(--text-secondary);
  font-weight: 500;
}

.derivative-builder-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.derivative-builder-control[hidden] {
  display: none;
}

.derivative-builder-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.derivative-builder-copy strong {
  color: var(--text-primary);
  font-size: 0.75rem;
  line-height: 1.25;
}

.derivative-builder-copy span {
  color: var(--text-muted);
  font-size: 0.6875rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.derivative-builder-control[data-health="healthy"] .derivative-builder-copy span {
  color: #387a55;
}

.derivative-builder-modes {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.055);
}

.derivative-builder-modes button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 650;
  line-height: 1.2;
  padding: 6px 8px;
}

.derivative-builder-modes button.is-selected {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.derivative-builder-modes button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.derivative-builder-control[data-can-manage="false"] .derivative-builder-modes button:disabled {
  cursor: not-allowed;
}

.sync-status-job-column {
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  overflow: hidden;
}

.sync-status-job-column-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sync-status-job-column-head h3 {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.25;
  font-weight: 650;
  color: var(--text-primary);
}

.sync-status-job-column-head span {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  line-height: 1.2;
  color: var(--text-muted);
}

.sync-status-job-list {
  max-height: min(68vh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 3px 0;
}

.sync-status-job-row {
  display: block;
  min-width: 100%;
  width: max-content;
  padding: 6px 10px;
}

.sync-status-job-row + .sync-status-job-row {
  border-top: 1px solid rgba(0, 0, 0, 0.035);
}

.sync-status-job-group {
  display: block;
  min-width: 100%;
  width: max-content;
}

.sync-status-job-group-title {
  white-space: nowrap;
  font-weight: 650;
}

.sync-status-job-more {
  color: var(--text-muted);
  font-style: italic;
}

.sync-status-job-line {
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 0.71875rem;
  line-height: 1.35;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.sync-status-empty {
  padding: 12px 10px;
  color: var(--text-muted);
  font-size: 0.71875rem;
  line-height: 1.35;
}

@keyframes sync-status-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
  .sync-status-widget {
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--safe-bottom) + 8px);
    max-width: calc(100vw - 16px);
  }

  .sync-status-widget.is-expanded {
    display: flex;
    flex-direction: column;
    width: calc(100vw - 16px);
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 16px);
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
    overflow: hidden;
  }

  .sync-status-widget.is-expanded .sync-status-main,
  .sync-status-widget.is-expanded .sync-status-rows {
    flex: 0 0 auto;
  }

  .sync-status-widget.is-expanded .sync-status-expanded-panel {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .sync-status-main {
    gap: 6px;
  }

  .sync-status-collapse-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .sync-status-full-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .sync-status-row,
  .sync-status-diagnostic-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .derivative-builder-control {
    align-items: stretch;
    flex-direction: column;
  }

  .derivative-builder-modes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .derivative-builder-modes button {
    min-height: 44px;
  }

  .sync-status-job-list {
    max-height: min(30dvh, 320px);
  }
}

/* ===== USER AVATAR (Auth) ===== */
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid var(--accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
#btn-login .material-symbols-outlined {
  font-size: 26px;
}

/* ===== LOGIN WALL (Access Gate) ===== */
.login-wall {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease;
}
.login-wall.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.login-wall-content {
  text-align: center;
  padding: 48px 40px;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  max-width: 400px;
  width: 90vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  animation: loginWallFadeIn 0.6s ease;
}
@keyframes loginWallFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-wall-logo-img {
  width: 120px;
  height: auto;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  animation: loginLogoFloat 3s ease-in-out infinite;
}
@keyframes loginLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.login-wall-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 28px;
  color: #fff;
  letter-spacing: 4px;
  margin: 0 0 8px;
}
.login-wall-subtitle {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  margin: 0 0 32px;
  line-height: 1.5;
}
.login-wall-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.login-wall-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.login-wall-btn:active {
  transform: translateY(0);
}
.login-wall-hint {
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  margin: 24px 0 0;
}

/* ===== HOME LOGO BUTTON ===== */
.home-logo-btn {
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.home-logo-btn:hover {
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.home-logo-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.home-logo-img {
  height: 28px;
  width: auto;
  display: block;
  opacity: 0.84;
  filter: saturate(0.92) contrast(0.94);
}

/* ===== CUSTOM COVER CONTEXT MENU ===== */
.cover-context-menu {
  position: fixed;
  z-index: 99998;
  min-width: 200px;
  max-width: min(320px, calc(100vw - 16px));
  max-height: min(calc(100dvh - 16px), 72vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 4px;
  animation: cover-menu-in 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.cover-context-heading {
  padding: 8px 14px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

@keyframes cover-menu-in {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.cover-context-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s ease;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.cover-longpress-active,
.cover-longpress-active * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

.cover-context-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.cover-context-item:disabled {
  opacity: 0.62;
  cursor: wait;
  background: transparent;
  color: var(--text-secondary);
}

.cover-context-item:active {
  transform: scale(0.98);
}

/* Custom cover badge on album card */
.cover-custom-badge {
  background: rgba(255, 255, 255, 0.55);
  color: #404040;
  padding: 4px;
  border-radius: 6px;
  z-index: 2;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.cover-custom-badge .material-symbols-outlined {
  font-size: 16px;
  display: block;
}

/* album-card needs relative for badge positioning */
.album-card {
  position: relative;
}

/* Luxie Lưu Trữ (NAS2, 14/10/2026): kho chỉ xem và tải — ẩn chấm sao và chọn máy dựng. */
.edition-luu-tru #lightbox-rating,
.edition-luu-tru [data-derivative-builder],
.edition-marketing #lightbox-rating,
.edition-marketing [data-derivative-builder] {
  display: none !important;
}

/* ===== MOBILE GALLERY COMPOSITION ===== */
@media (max-width: 599px) {
  .top-bar {
    flex-wrap: wrap;
    gap: 2px 0;
    padding: calc(var(--safe-top) + 2px) 10px 4px;
  }

  .top-bar-left {
    flex: 1 0 100%;
    flex-basis: 100%;
    gap: 4px;
  }

  /* Keep Home in its original leading position: LUX → Back → album title. */
  .top-bar-left:has(#btn-back:not([style*="display: none"])) .home-logo-btn {
    order: 0;
    /* Bề rộng do luật nút logo quyết định (n06: 40px). Đặt 44px ở đây làm logo phình khi vào thư mục con (15/10). */
    flex: 0 0 auto;
  }

  .top-bar-right {
    width: 100%;
    flex: 1 0 100%;
    justify-content: flex-end;
    gap: 2px;
    min-width: 0;
  }

  .top-bar-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.1rem;
    line-height: 1.12;
  }

  .home-logo-btn,
  #btn-back,
  #btn-search,
  #btn-share,
  #btn-login {
    width: 44px;
    height: 44px;
  }

  .home-logo-btn {
    padding: 6px 8px;
    border-radius: 12px;
  }

  .home-logo-img {
    height: 26px;
  }

  #btn-back {
    margin: 0;
  }

  #btn-back .material-symbols-outlined {
    font-size: 24px;
    transform: none;
  }

  .search-container {
    flex: 0 0 auto;
  }

  .top-bar-meta {
    margin-right: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8125rem;
  }

  .download-current-folder-btn {
    height: 44px;
    padding: 0 10px;
    gap: 4px;
  }

  .top-bar.search-mode {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .top-bar.search-mode .top-bar-left {
    flex: 0 0 auto;
  }

  .top-bar.search-mode .top-bar-right {
    width: auto;
    flex: 1 1 auto;
  }

  .album-grid {
    gap: 10px;
    padding: 12px;
  }

  .album-card-info {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    min-height: 104px;
    padding: 10px 12px 11px;
  }

  .album-card-info.has-actions {
    padding-right: 12px;
  }

  .album-card-title {
    margin-bottom: 4px;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow-wrap: break-word;
  }

  .album-card-actions {
    width: auto;
    align-self: end;
    justify-self: start;
    gap: 6px;
  }

  .album-card-share-btn,
  .album-card-download-btn {
    position: relative;
    height: 38px;
    min-height: 0;
    border-radius: 9px;
  }

  .album-card-share-btn::after,
  .album-card-download-btn::after {
    content: '';
    position: absolute;
    inset: -3px;
  }

  .album-card-download-btn {
    flex: 0 0 auto;
    min-width: 68px;
    padding: 0 9px;
  }

  .album-card-share-btn {
    flex: 0 0 38px;
    width: 38px;
  }

  .album-card-download-label {
    font-size: 0.75rem;
  }

  .album-card-info .cover-custom-badge {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 359px) {
  .top-bar-meta {
    display: none;
  }
}

/* ===================================================================================================
 * GIAO DIỆN n06 · KÍNH LỎNG + NÚT Ô NỔI (Sơn chọn 14/10/2026 trong vòng mẫu temp/luxie-thu/v2/n06-thanh-tren-o-noi.html)
 * Lớp này đè lên phần trên, không đổi bố cục hay hành vi:
 *  - Thanh trên là viên kính lỏng nổi (mép sáng, ánh xanh/cam ở hai đầu như khúc xạ, iOS 26).
 *  - Nút việc là "ô nổi bóng sâu" (mẫu 25 của LuxBase: ô trắng chuyển nhẹ, bóng sâu, hình mang màu việc):
 *    Tải xanh dương, link xanh lá, báo lỗi đỏ, còn lại trung tính.
 *  - Thẻ bo 16, bóng mềm; nền trang có vệt màu nhạt để kính có thứ phía sau.
 * Lưới ảnh giữ nguyên số cột và khe (cuộn ảo tính theo đó).
 * =================================================================================================== */
:root {
  --bg-primary: #f3f4f7;
  --n6-ink: #14161a;
  --n6-ink-2: #464a52;
  --n6-ink-3: #686d76;
  --n6-accent: #2563eb;
  --n6-ease: cubic-bezier(.16, 1, .3, 1);
  --n6-spring: cubic-bezier(.34, 1.56, .64, 1);
  --n6-glass: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .28));
  --n6-glass-blur: blur(10px) saturate(2.1) brightness(1.06);
  --n6-lg-edge:
    inset 0 0 0 1px rgba(255, 255, 255, .5),
    inset 3px 3px 1.5px -1.5px #fff,
    inset -3px -3px 1.5px -1.5px rgba(255, 255, 255, .85),
    inset 0 -12px 18px -12px rgba(255, 255, 255, .95),
    inset 0 14px 20px -16px rgba(255, 255, 255, .95),
    inset 10px 0 14px -10px rgba(70, 130, 255, .45),
    inset -10px 0 14px -10px rgba(255, 128, 88, .4);
  --n6-lg-drop: 0 0 0 .5px rgba(24, 30, 52, .14), 0 8px 20px -8px rgba(24, 30, 52, .2), 0 24px 48px -24px rgba(24, 30, 52, .24);
  --n6-card-shadow: 0 0 0 .5px rgba(24, 30, 52, .06), 0 1px 2px rgba(24, 30, 52, .04), 0 10px 26px -16px rgba(24, 30, 52, .22);
  --n6-card-shadow-hover: 0 0 0 .5px rgba(24, 30, 52, .07), 0 2px 4px rgba(24, 30, 52, .05), 0 20px 40px -18px rgba(24, 30, 52, .26);
  /* Ô nổi */
  --o-face: linear-gradient(#ffffff, #f3f5f9);
  --o-shadow: 0 4px 12px #1d2a4424, 0 1px 2px #1d2a4414, inset 0 1px 0 #fff;
  --o-lift: 0 9px 20px -2px #1d2a442e, 0 2px 4px #1d2a4418, inset 0 1px 0 #fff;
  --o-press: 0 1px 3px #1d2a4422, inset 0 1px 0 #fff;
  --o-ink: #3d4a60;
  --o-tai: oklch(0.56 0.14 250);
  --o-link: oklch(0.58 0.14 150);
  --o-loi: oklch(0.6 0.18 25);
  --o-sao: oklch(0.74 0.16 75);
  /* Khung bọc ô phải đồng dạng với ô: bo khung = bo ô + khoảng đệm (Sơn 14/10: khung tròn ôm ô vuông trông như lỗi). */
  --n6-lb-tile-r: 12px;
  --n6-lb-pad: 6px;
}

body { background: var(--bg-primary); }
#gallery-app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 360px at 6% -8%, rgba(70, 128, 255, .46), transparent 70%),
    radial-gradient(560px 320px at 42% -10%, rgba(255, 120, 170, .30), transparent 70%),
    radial-gradient(600px 360px at 96% -6%, rgba(255, 176, 90, .42), transparent 70%),
    radial-gradient(800px 560px at 90% 100%, rgba(90, 206, 196, .16), transparent 70%),
    radial-gradient(700px 500px at 0% 85%, rgba(160, 140, 255, .14), transparent 70%);
}
#gallery-app { position: relative; isolation: isolate; }

/* ---------- Thanh trên: viên kính lỏng nổi ---------- */
.top-bar {
  top: calc(var(--safe-top) + 14px);
  margin: calc(var(--safe-top) + 14px) max(16px, calc((100% - 1200px) / 2)) 0;
  padding: 10px 12px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--n6-glass);
  backdrop-filter: var(--n6-glass-blur);
  -webkit-backdrop-filter: var(--n6-glass-blur);
  box-shadow: var(--n6-lg-edge), var(--n6-lg-drop);
}
.top-bar-title { font-size: 20px; letter-spacing: -.025em; text-shadow: 0 0 14px rgba(255, 255, 255, .9); }
.top-bar-meta, .breadcrumb-nav { text-shadow: 0 0 14px rgba(255, 255, 255, .9); }
.top-bar-meta { color: var(--n6-ink-3); padding: 0 2px; }
.top-bar-right { display: flex; align-items: center; gap: 8px; }
.top-bar-left { gap: 10px; }
.breadcrumb-item { border-radius: 999px; padding: 5px 9px; }
.breadcrumb-item:hover { background: rgba(255, 255, 255, .7); color: var(--n6-ink); }

.home-logo-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--n6-lg-edge), 0 0 0 .5px rgba(24, 30, 52, .10), 0 3px 8px -3px rgba(24, 30, 52, .2);
}
.home-logo-btn .home-logo-img { height: auto; width: 27px; }

/* Nút biểu tượng trên thanh = ô nổi 32px không chữ */
.top-bar #btn-back,
.top-bar #btn-search,
.top-bar #btn-search-clear,
.top-bar #btn-share,
.top-bar #btn-login,
.top-bar #btn-bug-report,
.top-bar #btn-raw-ratings,
.top-bar #btn-sort,
.top-bar #btn-upload,
.top-bar #btn-download-current-folder {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--o-face);
  color: var(--o-ink);
  box-shadow: var(--o-shadow);
  transition: translate .35s var(--n6-ease), scale .45s var(--n6-spring), box-shadow .3s var(--n6-ease);
}
.top-bar #btn-back .material-symbols-outlined,
.top-bar #btn-search .material-symbols-outlined,
.top-bar #btn-search-clear .material-symbols-outlined,
.top-bar #btn-share .material-symbols-outlined,
.top-bar #btn-login .material-symbols-outlined,
.top-bar #btn-bug-report .material-symbols-outlined,
.top-bar #btn-raw-ratings .material-symbols-outlined,
.top-bar #btn-sort .material-symbols-outlined,
.top-bar #btn-upload .material-symbols-outlined,
.top-bar #btn-download-current-folder .material-symbols-outlined {
  font-size: 18px;
  transform: none;
}
.top-bar #btn-bug-report { color: var(--o-loi); }
/* Chuyển sao sang RAW (v371): ô sao vàng, chỉ nhân sự ở album / Ảnh Gốc. */
.top-bar #btn-raw-ratings { color: var(--o-sao); }
.top-bar #btn-bug-report .diagnostic-report-label,
.top-bar #btn-download-current-folder .download-current-folder-label { display: none; }
.top-bar #btn-download-current-folder,
.top-bar #btn-upload,
.top-bar #btn-share { color: var(--o-tai); }
.top-bar #btn-share { color: var(--o-link); }
.top-bar #btn-download-current-folder:disabled { opacity: .45; }
.user-avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--n6-accent); }
.search-container { gap: 8px; }
.search-container.active .search-input {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  box-shadow: inset 0 0 0 .5px rgba(24, 30, 52, .12), 0 2px 6px -2px rgba(24, 30, 52, .15);
}

/* ---------- Thẻ thư mục ---------- */
.album-grid { gap: 20px; padding: 24px 16px 8px; max-width: 1200px; }
.album-card {
  border: 0;
  border-radius: 16px;
  box-shadow: var(--n6-card-shadow);
  transition: box-shadow .45s var(--n6-ease), transform .45s var(--n6-ease);
}
.album-card:hover { border-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  .album-card:hover { transform: translateY(-3px); box-shadow: var(--n6-card-shadow-hover); }
  .album-card:hover .album-card-thumb { transform: scale(1.04); }
}
.album-card-thumb { transition: transform 1s var(--n6-ease); }
.album-card-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.album-card-count { font-size: 12.5px; color: var(--n6-ink-3); }
.album-card-info { align-items: center; gap: 12px; padding: 12px 14px; }
.album-card-actions { gap: 8px; align-items: flex-start; }

/* Nút Tải / Link trên thẻ = ô nổi 40px, chữ nhỏ dưới ô */
.album-card-download-btn,
.album-card-share-btn {
  width: auto;
  min-width: 42px;
  height: auto;
  padding: 0;
  gap: 5px;
  border: 0;
  border-radius: 13px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  color: var(--o-tai);
}
.album-card-share-btn { color: var(--o-link); }
.album-card-download-btn .material-symbols-outlined,
.album-card-share-btn .material-symbols-outlined {
  width: 40px;
  height: 40px;
  font-size: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--o-face);
  box-shadow: var(--o-shadow);
  transition: translate .35s var(--n6-ease), scale .45s var(--n6-spring), box-shadow .3s var(--n6-ease);
}
.album-card-download-btn .material-symbols-outlined svg,
.album-card-share-btn .material-symbols-outlined svg { width: 20px; height: 20px; }
.album-card-download-label,
.album-card-share-label {
  display: block;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 500;
  color: #5f687a;
}
.album-card-share-btn:hover,
.album-card-download-btn:hover,
.album-card-share-btn.share-feedback-active {
  background: transparent;
  box-shadow: none;
}

/* ---------- Lưới ảnh (giữ cột và khe) ----------
 * Viên tên file không kính mờ: đo 15/10 trên Chrome của Sơn, kính mờ ở ~170 ô làm cuộn còn khoảng nửa số khung
 * hình (72 → 47). Nút link là ô nổi nhỏ (bóng nhỏ, nhấc khi rê): đo không thấy chậm, Sơn giữ. */
.grid-item { border-radius: 12px; }
.grid-item-filename {
  background: rgba(255, 255, 255, .9);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--n6-ink);
  box-shadow: none;
  text-shadow: none;
}
.grid-item-share-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px; /* ô ảnh bo 12, nút cách mép 6 */
  background: var(--o-face);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--o-link);
  box-shadow: var(--o-shadow);
  transition: translate .35s var(--n6-ease), scale .45s var(--n6-spring), box-shadow .3s var(--n6-ease);
}
.grid-item-share-btn:hover,
.grid-item-share-btn.share-feedback-active { background: var(--o-face); border-color: transparent; box-shadow: var(--o-lift); }
@media (hover: hover) and (pointer: fine) {
  .grid-item-share-btn:hover { translate: 0 -2px; }
}
.grid-item-share-btn:active { translate: 0 0; scale: .93; box-shadow: var(--o-press); }

/* ---------- Nút trạng thái ảnh góc dưới (dạng thu gọn) ---------- */
.sync-status-widget.is-icon .sync-status-expand-button {
  border: 0;
  background: var(--o-face);
  color: var(--o-ink);
  box-shadow: var(--o-shadow);
}

/* ---------- Xem ảnh lớn ---------- */
.lightbox-header { background: none; padding: calc(var(--safe-top) + 12px) 14px 10px; }
.lightbox-header-left,
.lightbox-header-right,
.lightbox-header-center,
.lightbox-rating,
.filter-bar {
  border: 0;
  background: var(--n6-glass);
  backdrop-filter: var(--n6-glass-blur);
  -webkit-backdrop-filter: var(--n6-glass-blur);
  box-shadow: var(--n6-lg-edge), var(--n6-lg-drop);
}
.lightbox-header-left,
.lightbox-header-right { gap: 6px; padding: var(--n6-lb-pad); border-radius: calc(var(--n6-lb-tile-r) + var(--n6-lb-pad)); }
.lightbox-header-center { top: calc(var(--safe-top) + 12px); padding: 6px 22px 7px; border-radius: 999px; }
/* Máy tính: tên thư mục · tên ảnh · số thứ tự trên một hàng, cao bằng hai khung nút hai bên (Sơn 14/10). */
@media (min-width: 768px) {
  .lightbox-header-center {
    flex-direction: row;
    align-items: center;
    gap: 9px;
    height: calc(36px + 2 * var(--n6-lb-pad));
    padding: 0 22px;
    white-space: nowrap;
  }
  .lightbox-header-center .lightbox-album-name,
  .lightbox-header-center .lightbox-counter { font-size: 0.8125rem; letter-spacing: 0; }
  .lightbox-header-center .lightbox-photo-name { font-size: 0.9375rem; max-width: 420px; }
  .lightbox-header-center > span + span::before {
    content: "·";
    margin-right: 9px;
    color: var(--n6-ink-3);
    font-weight: 400;
  }
  .lightbox-header-center > span:empty,
  .lightbox-header-center > span[hidden] { display: none; }
}
.lightbox-photo-name { font-weight: 600; }
.lightbox-icon-btn,
.lightbox-header #btn-bug-report {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--n6-lb-tile-r);
  background: var(--o-face);
  color: var(--o-ink);
  box-shadow: var(--o-shadow);
  transition: translate .35s var(--n6-ease), scale .45s var(--n6-spring), box-shadow .3s var(--n6-ease);
}
.lightbox-icon-btn .material-symbols-outlined { font-size: 19px; }
.lightbox-header #btn-bug-report { color: var(--o-loi); }
.lightbox-header #btn-bug-report .diagnostic-report-label { display: none; }
#btn-lightbox-share { color: var(--o-link); }
#btn-download { color: var(--o-tai); }
.lightbox-icon-btn:hover,
.lightbox-icon-btn.share-feedback-active { background: var(--o-face); }
/* Nút video nằm trên nền đen: giữ kiểu cũ (chữ trắng, nền đen mờ), không theo ô nổi. */
.video-controls .lightbox-icon-btn.video-control-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .34);
  box-shadow: none;
  translate: none;
  scale: none;
}
.video-controls .lightbox-icon-btn.video-control-btn:hover,
.video-controls .lightbox-icon-btn.video-control-btn:active { background: rgba(0, 0, 0, .52); box-shadow: none; translate: none; scale: none; }
.video-controls .lightbox-icon-btn.video-control-btn .material-symbols-outlined { font-size: 24px; }

.lightbox-nav {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 15px;
  background: var(--o-face);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--o-ink);
  box-shadow: var(--o-shadow);
}
.lightbox-nav:hover { background: var(--o-face); }

.lightbox-rating,
.filter-bar { border-radius: 12px; } /* ô lọc bo 8 + đệm 4 */
.rating-star .material-symbols-outlined { color: #9aa0a9; }
.rating-star.active .material-symbols-outlined { color: var(--o-sao); }
.rating-clear { border-right-color: rgba(20, 24, 32, .12); }
.filter-chip { border-radius: 8px; color: var(--n6-ink-2); }
.filter-chip.active {
  background: var(--o-face);
  box-shadow: 0 2px 6px #1d2a4424, 0 1px 1px #1d2a4414, inset 0 1px 0 #fff;
  color: var(--n6-ink);
}
.filter-chip:hover { background: rgba(255, 255, 255, .8); }
.filter-chip.active:hover { background: var(--o-face); }
.filter-download-btn {
  border: 0;
  border-radius: 10px;
  background: var(--o-face);
  color: var(--o-tai);
  box-shadow: var(--o-shadow);
}
.filter-download-btn:hover:not(:disabled) { color: var(--o-tai); box-shadow: var(--o-lift); }

/* Cỡ chỉ đổi trên máy tính; điện thoại giữ cỡ cũ để thanh sao và thanh lọc vừa một hàng 390px. */
@media (min-width: 768px) {
  .lightbox-rating,
  .filter-bar { min-height: 40px; padding: 4px 8px; gap: 3px; }
  .filter-chip { min-width: 26px; height: 26px; }
  .filter-download-btn { height: 30px; margin-left: 6px; padding: 0 12px; }
}

/* ---------- Rê và nhấn: ô nổi nhấc lên, nhấn thì lún ---------- */
@media (hover: hover) and (pointer: fine) {
  .top-bar #btn-back:hover, .top-bar #btn-search:hover, .top-bar #btn-search-clear:hover,
  .top-bar #btn-share:hover, .top-bar #btn-login:hover, .top-bar #btn-bug-report:hover,
  .top-bar #btn-download-current-folder:hover:not(:disabled), .top-bar #btn-raw-ratings:hover, .top-bar #btn-sort:hover,
  .top-bar #btn-upload:hover,
  .lightbox-icon-btn:hover, .lightbox-header #btn-bug-report:hover, .lightbox-nav:hover,
  .album-card-download-btn:hover .material-symbols-outlined,
  .album-card-share-btn:hover .material-symbols-outlined,
  .sync-status-widget.is-icon .sync-status-expand-button:hover {
    translate: 0 -2px;
    background: var(--o-face);
    box-shadow: var(--o-lift);
  }
  .home-logo-btn:hover { scale: 1.08; transition: scale .5s var(--n6-spring); }
}
.top-bar #btn-back:active, .top-bar #btn-search:active, .top-bar #btn-share:active, .top-bar #btn-login:active,
.top-bar #btn-bug-report:active, .top-bar #btn-download-current-folder:active:not(:disabled), .top-bar #btn-raw-ratings:active,
.top-bar #btn-sort:active, .top-bar #btn-upload:active, .top-bar #btn-search-clear:active,
.lightbox-icon-btn:active, .lightbox-header #btn-bug-report:active,
.album-card-download-btn:active .material-symbols-outlined,
.album-card-share-btn:active .material-symbols-outlined {
  translate: 0 0;
  scale: .93;
  box-shadow: var(--o-press);
}
.album-card-download-btn:active, .album-card-share-btn:active { transform: none; }

/* ---------- Điện thoại ---------- */
@media (max-width: 599px) {
  .top-bar {
    top: calc(var(--safe-top) + 8px);
    margin: calc(var(--safe-top) + 8px) 8px 0;
    padding: 8px 10px 8px;
    gap: 6px 0;
    border-radius: 26px;
  }
  .top-bar-right { gap: 8px; }
  .top-bar .home-logo-btn { width: 40px; height: 40px; flex: 0 0 40px; padding: 0; border-radius: 999px; }
  .top-bar-title { font-size: 19px; }
  .album-grid { gap: 12px; padding: 14px 12px 4px; }
  .album-card-info { gap: 10px; padding: 10px 10px 11px 12px; }
  .album-card-thumb { aspect-ratio: 1; }
  /* Cụm nút bám mép phải thẻ, hai nút sát nhau (Sơn 14/10: nút bên trái trông chơi vơi). */
  .album-card-actions { justify-self: end; gap: 8px; }
  .album-card-download-btn,
  .album-card-share-btn { width: auto; min-width: 38px; height: auto; flex: 0 0 auto; }
  .album-card-download-btn .material-symbols-outlined,
  .album-card-share-btn .material-symbols-outlined { width: 38px; height: 38px; }
  /* Thẻ album gọn (Sơn 15/10/2026): hàng 1 tên một dòng, dài thì "…"; hàng 2 số đếm bên trái, nút ô nổi 34px bên phải,
     bỏ chữ dưới nút (màu nút đã phân biệt Tải xanh dương, Link xanh lá). Phần chữ cao ~140 → ~76px. */
  .album-card-info {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas: "title title" "count actions";
    align-items: center;
    gap: 6px 8px;
    min-height: 0;
    padding: 10px 10px 10px 12px;
  }
  .album-card-copy { display: contents; }
  .album-card-title {
    grid-area: title;
    display: block;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .album-card-info:has(.cover-custom-badge) .album-card-title { padding-right: 24px; }
  .album-card-count {
    grid-area: count;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .album-card-actions { grid-area: actions; align-self: center; gap: 6px; }
  .album-card-download-label,
  .album-card-share-label { display: none; }
  .album-card-download-btn .material-symbols-outlined,
  .album-card-share-btn .material-symbols-outlined { width: 34px; height: 34px; border-radius: 11px; }
  .album-card-download-btn .material-symbols-outlined svg,
  .album-card-share-btn .material-symbols-outlined svg { width: 18px; height: 18px; }
  .grid-item-share-btn { width: 26px; height: 26px; border-radius: 6px; }
  .lightbox-header { padding: calc(var(--safe-top) + 8px) 8px 8px; }
  .lightbox-header-center { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; top: calc(var(--safe-top) + 10px); padding: 2px 4px; }
  .lightbox-header { --n6-lb-tile-r: 11px; --n6-lb-pad: 5px; }
  .lightbox-header-left, .lightbox-header-right { gap: 4px; }
  .lightbox-icon-btn, .lightbox-header #btn-bug-report { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .album-card, .album-card-thumb,
  .top-bar #btn-back, .top-bar #btn-search, .top-bar #btn-share, .top-bar #btn-login, .top-bar #btn-bug-report,
  .top-bar #btn-download-current-folder, .lightbox-icon-btn, .album-card-download-btn .material-symbols-outlined,
  .album-card-share-btn .material-symbols-outlined { transition: none; }
}

/* Chữ "LUX studio" ở trang gốc (Sơn 15/10/2026): Optima có nét loe giống logo LUX, có sẵn trên Mac và iPhone;
   máy khác dùng phông gần nhất. LUX chữ hoa đậm giãn rộng, studio chữ thường nhẹ màu hơn. */
.brand-wordmark {
  font-family: Optima, 'Optima Nova', Candara, 'Segoe UI', var(--font-ui);
  font-size: 1.08em;
  letter-spacing: 0;
  font-feature-settings: normal;
}
.brand-wordmark-lux { font-weight: 700; letter-spacing: .14em; margin-right: -.06em; }
.brand-wordmark-studio { font-weight: 400; letter-spacing: .03em; color: var(--n6-ink-2); }

/* Tiêu điểm nằm ở khung ảnh lớn (gallery-accessibility.js) chỉ để phím hoạt động, không vẽ viền. */
#lightbox:focus { outline: none; }

/* ===================================================================================================
 * GÓP Ý CHỈNH SỬA TRÊN ẢNH (thử 16/10/2026, modules/photo-notes.js)
 * Khách ghim chỗ cần sửa, người chỉnh sửa đánh dấu đã sửa. Theo n06: nền sáng có vệt màu, thanh kính lỏng,
 * nút là ô nổi. Màu việc: chờ sửa cam, đã sửa xanh lá (cùng màu link), ghim đang đặt xanh dương (cùng màu tải).
 * =================================================================================================== */
:root {
  --note-open: oklch(0.63 0.17 45);
  --note-open-soft: oklch(0.96 0.03 60);
  --note-done: var(--o-link);
  --note-done-soft: oklch(0.96 0.03 150);
  --note-draft: var(--o-tai);
}

/* Huy hiệu trên lưới: cạnh phải dưới, sao giữ cạnh trái. Nền đặc (lặp hàng trăm lần: không kính mờ). */
.grid-note-badge {
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 7px 0 5px;
  border-radius: 7px;
  background: var(--note-open);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(24, 30, 52, .28);
  pointer-events: none;
}
.grid-note-badge .material-symbols-outlined { width: 14px; height: 14px; font-size: 14px; display: inline-grid; }
.grid-note-badge svg { width: 14px; height: 14px; stroke-width: 2.2; }
.grid-note-badge.is-done { background: var(--note-done); padding: 0; width: 22px; justify-content: center; }
/* Thẻ thư mục: số góp ý chờ sửa bên trong (nhân sự), góc phải trên ảnh bìa. */
.grid-note-badge.is-folder { top: 10px; right: 10px; height: 24px; padding: 0 9px 0 7px; font-size: 12px; gap: 4px; }

/* Nút "Tạo thiệp" (app Thiệp cưới, 17/11/2026): ô nổi có chữ ở góc TRÁI trên ảnh bìa thẻ "Chỉnh Sửa", chỉ nhân sự.
   Góc phải đã dành cho số góp ý (.grid-note-badge.is-folder) và huy hiệu bìa tùy chọn trên điện thoại. Bo 8px = bo thẻ 16
   − khoảng cách 8 tới mép (DESIGN.md "Khung bọc đồng dạng với nút"). Màu hình trung tính như mọi nút "còn lại". */
.album-card-thiep-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  height: 30px;
  padding: 0 11px 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--o-face);
  color: var(--o-ink);
  box-shadow: var(--o-shadow);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: translate .35s var(--n6-ease), box-shadow .3s var(--n6-ease);
}
.album-card-thiep-btn .material-symbols-outlined { width: 16px; height: 16px; font-size: 16px; display: inline-grid; }
.album-card-thiep-btn .material-symbols-outlined svg { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) {
  .album-card-thiep-btn:hover { translate: 0 -2px; box-shadow: var(--o-lift); }
}
.album-card-thiep-btn:active { translate: 0 1px; box-shadow: var(--o-press); }
.album-card-thiep-btn:focus-visible { outline: 2px solid var(--o-tai); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .album-card-thiep-btn { transition: none; } }

/* Nút góp ý trong màn ảnh lớn: ô nổi cam, số chờ sửa ở góc. */
#btn-notes { position: relative; color: var(--note-open); }
#btn-notes .note-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--note-open);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #fff;
}
#btn-notes .note-count.is-done { background: var(--note-done); padding: 0; display: grid; place-items: center; }
#btn-notes .note-count svg { width: 12px; height: 12px; stroke-width: 2.6; }

/* Lời chỉ chỗ lần đầu cho khách */
.note-coach {
  position: fixed;
  z-index: 9700;
  max-width: 250px;
  padding: 11px 14px;
  border-radius: 14px;
  background: #fff;
  color: var(--n6-ink);
  box-shadow: 0 12px 30px -10px rgba(24, 30, 52, .35), 0 0 0 .5px rgba(24, 30, 52, .1);
  display: grid;
  gap: 2px;
  font-size: 13.5px;
  line-height: 1.4;
  opacity: 0;
  translate: 0 -6px;
  transition: opacity .25s var(--n6-ease), translate .35s var(--n6-ease);
  pointer-events: none;
}
.note-coach strong { color: var(--note-open); font-size: 14px; }
.note-coach::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 12px;
  height: 12px;
  background: #fff;
  rotate: 45deg;
  border-radius: 2px;
}
.note-coach.is-visible { opacity: 1; translate: 0 0; }

/* Thanh góp ý trên lưới ảnh */
.note-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px max(16px, calc((100% - 1200px) / 2)) 0;
  padding: 8px 8px 8px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--n6-card-shadow);
  color: var(--n6-ink-2);
  font-size: 14px;
  line-height: 1.35;
}
.note-bar[hidden] { display: none; }
.note-bar strong { color: var(--n6-ink); font-weight: 650; }
.note-bar-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--note-open-soft);
  color: var(--note-open);
}
.note-bar-icon.is-done { background: var(--note-done-soft); color: var(--note-done); }
.note-bar-icon .material-symbols-outlined { font-size: 18px; }
.note-bar-text { flex: 1; min-width: 0; }
.note-bar-action {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--o-face);
  box-shadow: var(--o-shadow);
  color: var(--note-open);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: translate .35s var(--n6-ease), box-shadow .3s var(--n6-ease);
}
.note-bar-action:hover { translate: 0 -2px; box-shadow: var(--o-lift); }
.note-bar-action:active { translate: 0 1px; box-shadow: var(--o-press); }

/* Ô nổi dùng chung trong màn góp ý */
.note-tile {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--o-face);
  color: var(--o-ink);
  box-shadow: var(--o-shadow);
  cursor: pointer;
  transition: translate .35s var(--n6-ease), scale .45s var(--n6-spring), box-shadow .3s var(--n6-ease), opacity .2s;
}
.note-tile .material-symbols-outlined { font-size: 19px; }
.note-tile:hover:not(:disabled) { translate: 0 -2px; box-shadow: var(--o-lift); }
.note-tile:active:not(:disabled) { translate: 0 1px; box-shadow: var(--o-press); }
.note-tile:disabled { opacity: .35; cursor: default; }
.note-tile:focus-visible, .note-act:focus-visible, .note-chip:focus-visible, .note-send:focus-visible,
.note-bar-action:focus-visible, .note-pin:focus-visible, .note-inbox-row:focus-visible {
  outline: 2px solid var(--o-tai);
  outline-offset: 2px;
}

/* ── Màn góp ý (v378): chạy trong màn ảnh lớn ──
   Ảnh lớn (#lightbox) lo ảnh, phóng, kéo, vuốt; màn góp ý chỉ phủ đầu trang, lớp ghim, nút phóng và khung góp ý.
   Phần còn lại của màn góp ý để chạm xuyên xuống ảnh lớn (pointer-events: none). Khung ảnh lớn co vào khoảng giữa
   đầu trang và khung góp ý theo --notes-top/-bottom/-right do photo-notes.js đo. */
.lightbox.notes-open #lightbox-header,
.lightbox.notes-open #rating-bar,
.lightbox.notes-open .thumbnail-strip,
.lightbox.notes-open .lightbox-nav,
.lightbox.notes-open .exif-panel { display: none; }
/* Ô đồng bộ của nhân sự nằm góc dưới phải, đè nút gửi góp ý: ẩn khi đang góp ý. */
body.lightbox-notes-open #sync-status-widget { display: none; }
.lightbox.notes-open .lightbox-container {
  top: var(--notes-top, 0px);
  bottom: var(--notes-bottom, 0px);
  right: var(--notes-right, 0px);
  cursor: crosshair;
}
.note-view {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  color: var(--n6-ink);
  font-family: var(--font-ui);
  opacity: 0;
  transition: opacity .18s var(--n6-ease);
  -webkit-user-select: none;
  user-select: none;
  --note-keyboard: 0px;
}
.note-view.is-open { opacity: 1; }
.note-view[hidden] { display: none; }
/* Có bàn phím: màn góp ý bám phần màn hình nhìn thấy, đầu trang và ảnh không bị Safari đẩy khuất (v375). */
.note-view.has-keyboard { top: var(--note-vv-top, 0px); bottom: auto; height: var(--note-vv-h, 100dvh); }

.note-view-head {
  position: absolute;
  top: calc(var(--safe-top, 0px) + 10px);
  left: 12px;
  right: 12px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 18px;
  background: var(--n6-glass);
  backdrop-filter: var(--n6-glass-blur);
  -webkit-backdrop-filter: var(--n6-glass-blur);
  box-shadow: var(--n6-lg-edge), var(--n6-lg-drop);
}
.note-view.has-keyboard .note-view-head { top: 8px; }
.note-view-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.note-view-title strong { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.note-view-title span {
  font-size: 12.5px;
  color: var(--n6-ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.note-view-nav { display: flex; gap: 6px; }

/* Vùng ảnh: trùng khung ảnh lớn; chỉ chứa lớp ghim, nút phóng, lời nhắc. */
.note-stage {
  position: absolute;
  top: var(--stage-top, 0px);
  bottom: var(--stage-bottom, 0px);
  right: var(--stage-right, 0px);
  left: 0;
  overflow: hidden; /* ghim của phần ảnh đã kéo ra ngoài khung không vẽ đè đầu trang, khung góp ý */
  pointer-events: none;
}
.note-stage-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  translate: -50% 0;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 12px;
  color: var(--n6-ink-2);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-view.has-keyboard .note-stage-hint { display: none; }
/* Lớp ghim: photo-notes.js đặt vị trí và cỡ đúng bằng phần ảnh đang hiện, mỗi khung hình. */
.note-pins { position: absolute; left: 0; top: 0; pointer-events: none; }
.note-view.is-video .note-composer,
.note-view.is-video .note-zoom,
.note-view.is-video .note-stage-hint,
.note-view.is-video .note-pins { display: none; }
.note-zoom {
  position: absolute;
  right: 12px;
  bottom: 40px;
  z-index: 4;
  pointer-events: auto;
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 17px;
  background: var(--n6-glass);
  backdrop-filter: var(--n6-glass-blur);
  -webkit-backdrop-filter: var(--n6-glass-blur);
  box-shadow: var(--n6-lg-edge), var(--n6-lg-drop);
}
.note-view.has-keyboard .note-zoom { bottom: 8px; }
.note-zoom .note-tile { width: 32px; height: 32px; border-radius: 12px; }
.note-zoom .note-tile .material-symbols-outlined { font-size: 17px; }
.note-copy { display: none; }
@media (min-width: 900px) { .note-view.is-staff .note-copy { display: grid; } }
.note-strip { flex: none; padding: 12px 14px 4px; border-bottom: 1px solid rgba(24, 30, 52, .06); }
.note-strip[hidden] { display: none; }
/* Điện thoại: chỗ dành cho danh sách góp ý, chuyển ảnh bằng mũi tên. */
@media (max-width: 899px) { .note-strip { display: none; } }
.note-strip-label { display: block; margin: 0 2px 7px; font-size: 12.5px; color: var(--n6-ink-3); }
.note-strip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.note-strip-item {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #e6e8ee;
  cursor: pointer;
  box-shadow: 0 0 0 .5px rgba(24, 30, 52, .1);
  transition: box-shadow .2s, translate .3s var(--n6-ease);
}
.note-strip-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.note-strip-item:hover { translate: 0 -1px; }
.note-strip-item.is-current { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--o-tai); }
.note-strip-count {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--note-open);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 0 2px #fff;
}
.note-strip-count.is-done { background: var(--note-done); padding: 0; }
.note-strip-count svg { width: 11px; height: 11px; stroke-width: 2.8; }
.note-next {
  width: 100%;
  height: 40px;
  margin: 0 0 10px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--o-tai);
  color: #fff;
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(30, 80, 200, .7);
}
.note-next .material-symbols-outlined { font-size: 17px; }
.note-next svg { width: 17px; height: 17px; }
.note-card.is-new { animation: note-card-new 1.4s var(--n6-ease); }
@keyframes note-card-new { 0% { background: var(--note-open-soft); } 100% { background: #fff; } }
/* Ghim: đuôi nhọn chỉ đúng điểm, đầu tròn mang số. */
.note-pin {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  translate: -50% -100%;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 3px 5px rgba(24, 30, 52, .35));
  transition: scale .35s var(--n6-spring);
  transform-origin: 50% 100%;
}
.note-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 10px;
  height: 10px;
  translate: -50% 0;
  rotate: 45deg;
  background: var(--pin-color, var(--note-open));
  border-radius: 1px;
}
.note-pin > span {
  position: absolute;
  inset: 0 0 5px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pin-color, var(--note-open));
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .95);
  font-variant-numeric: tabular-nums;
}
.note-pin svg { width: 14px; height: 14px; stroke-width: 2.6; }
.note-pin .material-symbols-outlined { font-size: 14px; }
.note-pin.is-done { --pin-color: var(--note-done); width: 22px; height: 22px; opacity: .9; }
.note-pin.is-done::before { width: 7px; height: 7px; }
.note-pin.is-done svg { width: 11px; height: 11px; }
.note-pin.is-done.is-active { opacity: 1; }
/* Ẩn ghim chỉ ẩn ghim đã có; ghim vừa đặt luôn hiện, nếu không chạm ảnh trông như không ghim được (Sơn 17/10/2026). */
.note-view.pins-hidden .note-pin:not(.is-draft) { opacity: 0; pointer-events: none; }
.note-view.pins-hidden [data-note-pins-toggle] { color: var(--o-tai); }
.note-pin.is-other { opacity: .78; }
.note-pin.is-other > span { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .95), 0 0 0 2px var(--pin-color, var(--note-open)); background-clip: padding-box; }
.note-pin.is-active, .note-pin:hover { scale: 1.18; z-index: 2; }
.note-pin.is-draft { --pin-color: var(--note-draft); z-index: 3; animation: note-pin-drop .4s var(--n6-ease); }
.note-pin.is-draft > span::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--note-draft);
  animation: note-pin-pulse 1.6s var(--n6-ease) infinite;
}
@keyframes note-pin-drop { from { translate: -50% -140%; opacity: 0; } }
@keyframes note-pin-pulse { from { opacity: .7; scale: .8; } to { opacity: 0; scale: 1.5; } }

.note-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  max-height: 46%;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 .5px rgba(24, 30, 52, .07), 0 -10px 30px -22px rgba(24, 30, 52, .35);
}
.note-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 6px;
  -webkit-user-select: text;
  user-select: text;
}
.note-list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; font-size: 13px; color: var(--n6-ink-3); }
.note-list-head strong { font-size: 14.5px; color: var(--n6-ink); }

.note-empty { display: grid; justify-items: center; gap: 4px; padding: 14px 18px 18px; text-align: center; color: var(--n6-ink-3); font-size: 13.5px; line-height: 1.45; }
.note-empty strong { color: var(--n6-ink); font-size: 15px; }
.note-empty-art {
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--note-open-soft);
  color: var(--note-open);
}
.note-empty-art .material-symbols-outlined { font-size: 22px; }

.note-card {
  position: relative;
  padding: 11px 12px 9px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 .5px rgba(24, 30, 52, .09), 0 2px 6px -3px rgba(24, 30, 52, .14);
  transition: box-shadow .25s var(--n6-ease), background .25s;
}
.note-card.is-active { box-shadow: 0 0 0 2px var(--note-open), 0 8px 20px -12px rgba(24, 30, 52, .4); }
.note-card.is-done { background: #fbfcfb; }
.note-card.is-done.is-active { box-shadow: 0 0 0 2px var(--note-done), 0 8px 20px -12px rgba(24, 30, 52, .4); }
.note-card-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; color: var(--n6-ink-3); }
.note-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--note-open);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.note-card.is-done .note-num { background: var(--note-done); }
.note-num.is-whole { background: var(--note-open-soft); color: var(--note-open); }
.note-card.is-done .note-num.is-whole { background: var(--note-done-soft); color: var(--note-done); }
.note-num .material-symbols-outlined { font-size: 13px; }
.note-num svg { width: 13px; height: 13px; }
.note-who { color: var(--n6-ink); font-weight: 650; }
.note-stage-tag { padding: 1px 7px; border-radius: 6px; background: #eef0f4; color: var(--n6-ink-2); font-size: 11.5px; }
.note-status { margin-left: auto; font-weight: 650; color: var(--note-open); }
.note-status.is-done { color: var(--note-done); }
.note-status.is-replied { color: #fff; background: var(--o-tai); padding: 1px 8px; border-radius: 7px; }
.note-body { margin: 6px 0 2px 29px; font-size: 15px; line-height: 1.45; color: var(--n6-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-card.is-done .note-body { color: var(--n6-ink-2); }
.note-whole { color: var(--n6-ink-3); font-size: 13px; }
.note-replies { list-style: none; margin: 8px 0 0 29px; padding: 0; display: grid; gap: 6px; }
.note-reply { padding: 7px 10px; border-radius: 10px; background: #f4f5f8; font-size: 12.5px; color: var(--n6-ink-3); }
.note-reply.is-studio { background: var(--note-done-soft); }
.note-reply-who { color: var(--n6-ink); font-weight: 650; margin-right: 6px; }
.note-reply p { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--n6-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-actions { display: flex; gap: 6px; margin: 8px 0 0 29px; }
.note-act {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--o-face);
  box-shadow: var(--o-shadow);
  color: var(--o-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: translate .3s var(--n6-ease), box-shadow .3s var(--n6-ease), background .2s, color .2s;
}
.note-act .material-symbols-outlined { font-size: 15px; }
.note-act svg { width: 15px; height: 15px; }
.note-act:hover { translate: 0 -1px; box-shadow: var(--o-lift); }
.note-act:active { translate: 0 1px; box-shadow: var(--o-press); }
.note-act[data-note-action="resolve"] { color: var(--note-done); }
.note-act.is-on { background: var(--note-done); color: #fff; box-shadow: 0 3px 10px -3px rgba(24, 90, 52, .5); }
.note-act.is-quiet { margin-left: auto; padding: 0 8px; color: var(--n6-ink-3); background: transparent; box-shadow: none; }
.note-act.is-quiet:hover { color: var(--o-loi); background: #fff3f1; }
.note-act.is-quiet.is-confirm { color: #fff; background: var(--o-loi); box-shadow: 0 3px 10px -3px rgba(160, 40, 20, .5); padding: 0 10px; }

.note-composer {
  flex: none;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(24, 30, 52, .07);
  display: grid;
  gap: 8px;
}
.note-view.has-keyboard .note-composer { padding-bottom: 10px; }
.note-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -10px; padding: 2px 10px; }
.note-chips::-webkit-scrollbar { display: none; }
.note-chips[hidden] { display: none; }
.note-chip {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(24, 30, 52, .12);
  color: var(--n6-ink-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.note-chip:hover { box-shadow: 0 0 0 1px var(--note-open); color: var(--note-open); }
.note-chip:active { background: var(--note-open-soft); }
.note-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 5px 5px 5px 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(24, 30, 52, .13);
  flex-wrap: wrap;
}
.note-compose-row:focus-within { box-shadow: 0 0 0 2px var(--o-tai); }
.note-compose-target:empty { display: none; }
.note-compose-target { flex-basis: 100%; padding-top: 3px; }
.note-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 4px 0 9px;
  border-radius: 8px;
  background: #eef0f4;
  color: var(--n6-ink-2);
  font-size: 12.5px;
  font-weight: 650;
}
.note-target-chip.is-pin { background: oklch(0.95 0.03 250); color: var(--note-draft); }
.note-target-chip button { width: 20px; height: 20px; border: 0; padding: 0; background: none; color: inherit; display: grid; place-items: center; cursor: pointer; border-radius: 6px; }
.note-target-chip svg { width: 13px; height: 13px; }
.note-compose-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 132px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--n6-ink);
  font: inherit;
  font-size: 16px; /* 16px: iPhone không tự phóng trang khi bấm vào ô */
  line-height: 1.35;
  -webkit-user-select: text;
  user-select: text;
}
.note-compose-row textarea::placeholder { color: #8a8f99; }
.note-send {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--note-open);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(190, 80, 20, .6);
  cursor: pointer;
  transition: opacity .2s, translate .3s var(--n6-ease);
}
.note-send .material-symbols-outlined { font-size: 18px; }
.note-send:disabled { opacity: .35; box-shadow: none; cursor: default; }
.note-send:not(:disabled):active { translate: 0 1px; }
.note-view ::selection { background: oklch(0.9 0.06 250); }

/* Điện thoại (Sơn 17/10/2026: "phần này chiếm nhiều không gian"): khung góp ý chỉ cao vừa nội dung, phần còn lại
   nhường cho ảnh; thẻ góp ý và ô trống gọn lại, giữ đủ người viết, lúc viết, trạng thái, nội dung, nút. */
@media (max-width: 899px) {
  .note-list { flex: 0 1 auto; padding: 10px 10px 4px; }
  .note-view.has-keyboard .note-panel { max-height: 62%; }
  .note-list-head { margin: 0 2px 6px; font-size: 12.5px; }
  .note-list-head strong { font-size: 13.5px; }
  .note-card { padding: 8px 10px 8px; margin-bottom: 6px; border-radius: 12px; }
  .note-card-head { gap: 6px; font-size: 12px; }
  .note-num { width: 20px; height: 20px; font-size: 11px; }
  .note-body { margin: 3px 0 0 26px; font-size: 14.5px; line-height: 1.4; }
  .note-whole { font-size: 12.5px; }
  .note-replies { margin: 6px 0 0 26px; gap: 4px; }
  .note-reply { padding: 5px 9px; }
  .note-actions { margin: 6px 0 0 26px; gap: 6px; }
  .note-act { height: 28px; padding: 0 9px; font-size: 12.5px; gap: 4px; border-radius: 8px; }
  .note-act .material-symbols-outlined { font-size: 14px; }
  .note-act svg { width: 14px; height: 14px; }
  .note-empty { grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: 2px 10px; padding: 4px 4px 8px; text-align: left; font-size: 12.5px; line-height: 1.4; }
  .note-empty-art { grid-row: span 2; width: 34px; height: 34px; margin: 0; border-radius: 11px; }
  .note-empty-art .material-symbols-outlined { font-size: 18px; }
  .note-empty strong { font-size: 14px; }
  .note-composer { padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
}

/* Máy tính: ảnh bên trái chiếm phần lớn, cột góp ý bên phải. */
@media (min-width: 900px) {
  .note-view-head { top: 14px; left: 16px; right: 16px; padding: 7px 8px; border-radius: 20px; }
  .note-panel {
    top: 82px;
    right: 16px;
    bottom: 16px;
    left: auto;
    width: 380px;
    max-height: none;
    border-radius: 20px;
    box-shadow: var(--n6-card-shadow);
  }
  .note-list { flex: 1; }
  .note-composer { border-radius: 0 0 20px 20px; }
}
@media (min-width: 1400px) {
  .note-panel { width: 420px; }
}

/* Hộp việc của người chỉnh sửa */
.note-inbox {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: grid;
  place-items: start center;
  padding: calc(var(--safe-top, 0px) + 70px) 12px 12px;
  background: rgba(20, 24, 34, .28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.note-inbox-panel {
  width: min(560px, 100%);
  max-height: min(70dvh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 60px -20px rgba(24, 30, 52, .45);
  overflow: hidden;
}
.note-inbox-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 18px; }
.note-inbox-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--n6-ink); }
.note-inbox-list { list-style: none; margin: 0; padding: 0 8px 10px; overflow-y: auto; }
.note-inbox-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 0;
  border-radius: 14px;
  background: none;
  text-align: left;
  font: inherit;
  color: var(--n6-ink);
  cursor: pointer;
}
.note-inbox-row:hover:not(:disabled) { background: #f4f5f8; }
.note-inbox-row:disabled { opacity: .5; cursor: default; }
.note-inbox-row > .material-symbols-outlined { color: var(--n6-ink-3); }
.note-inbox-count {
  flex: none;
  min-width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--note-open-soft);
  color: var(--note-open);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.note-inbox-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.note-inbox-title { font-weight: 650; font-size: 15px; }
.note-inbox-meta { font-size: 12.5px; color: var(--n6-ink-3); }
.note-inbox-editor { display: inline-flex; align-items: center; gap: 5px; vertical-align: -4px; color: var(--n6-ink-2); font-weight: 600; }
.note-inbox-face { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex: none; background: #eef0f4; }
/* Luxie Lưu Trữ: góp ý chỉ xem (Sơn 20/10/2026) */
.note-view.is-readonly .note-composer, .note-view.is-readonly .note-actions:empty { display: none; }
.note-inbox-face.is-initial { display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--n6-ink-2); }
.note-inbox-quote { font-size: 13.5px; color: var(--n6-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) {
  .note-view, .note-pin, .note-tile, .note-act, .note-bar-action, .note-stage, .note-coach { transition: none; }
  .note-pin.is-draft, .note-pin.is-draft > span::after { animation: none; }
}

/* ===================================================================================================
 * CHUYỂN SAO JPG → RAW (16/10/2026, modules/raw-ratings.js). Thanh dùng chung dáng thanh góp ý; màu sao vàng n06.
 * =================================================================================================== */
.rr-dialog {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 24, 34, .3);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.rr-panel {
  width: min(620px, 100%);
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: #fff;
  color: var(--n6-ink);
  box-shadow: 0 30px 60px -20px rgba(24, 30, 52, .45);
  overflow: hidden;
}
.rr-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; }
.rr-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.rr-body { padding: 4px 20px 16px; overflow-y: auto; display: grid; gap: 12px; }
.rr-wait, .rr-note { margin: 0; color: var(--n6-ink-3); font-size: 13.5px; line-height: 1.45; }
.rr-error { margin: 0; color: var(--o-loi); font-size: 14px; line-height: 1.45; }
.rr-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rr-stat {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f5f8;
  font-size: 12.5px;
  color: var(--n6-ink-3);
}
.rr-stat strong { font-size: 22px; font-weight: 750; color: var(--n6-ink); font-variant-numeric: tabular-nums; }
.rr-stat.is-go { background: oklch(0.96 0.03 150); }
.rr-stat.is-go strong { color: var(--o-link); }
.rr-stat.is-warn { background: oklch(0.96 0.04 70); }
.rr-stat.is-warn strong { color: oklch(0.55 0.13 60); }
.rr-stat.is-miss strong { color: var(--o-loi); }
.rr-modes { display: grid; gap: 6px; }
.rr-seg-modes { width: 100%; }
.rr-seg-modes button { flex: 1; justify-content: center; height: 34px; font-size: 13px; }
.rr-modes .rr-note strong { color: var(--n6-ink); font-weight: 650; }
.rr-conflicts { display: grid; gap: 8px; }
.rr-conflicts-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rr-conflicts h3 { margin: 0; font-size: 14px; font-weight: 650; }
.rr-seg { display: inline-flex; padding: 3px; border-radius: 11px; background: #eef0f4; gap: 2px; }
.rr-seg button {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--n6-ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.rr-seg button[aria-pressed="true"] { background: #fff; color: var(--n6-ink); box-shadow: 0 1px 3px rgba(24, 30, 52, .18); }
.rr-seg button:focus-visible, .rr-btn:focus-visible, .rr-link:focus-visible { outline: 2px solid var(--o-tai); outline-offset: 2px; }
.rr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rr-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; background: #f8f9fb; }
.rr-row img, .rr-noimg { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: #e6e8ee; }
.rr-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-stars { display: inline-flex; align-items: center; gap: 1px; color: var(--o-sao); font-variant-numeric: tabular-nums; }
.rr-stars .material-symbols-outlined { font-size: 13px; }
.rr-stars svg { width: 13px; height: 13px; fill: currentColor; }
.rr-stars.is-zero, .rr-stars.is-none { color: var(--n6-ink-3); font-weight: 500; }
.rr-missing { font-size: 13px; color: var(--n6-ink-2); }
.rr-missing summary { cursor: pointer; font-weight: 600; }
.rr-missing p { margin: 6px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.rr-last { margin: 0; font-size: 13px; color: var(--n6-ink-3); }
.rr-link { border: 0; background: none; padding: 0 2px; color: var(--o-tai); font: inherit; font-weight: 650; cursor: pointer; }
.rr-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.rr-btn {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: var(--o-face);
  box-shadow: var(--o-shadow);
  color: var(--o-ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.rr-btn.is-primary { background: var(--o-link); color: #fff; box-shadow: 0 6px 16px -8px rgba(20, 110, 60, .7); }
.rr-btn:disabled { opacity: .45; cursor: default; }
.rr-done { display: grid; justify-items: center; gap: 6px; padding: 16px 8px; text-align: center; font-size: 14px; color: var(--n6-ink-2); }
.rr-done strong { color: var(--n6-ink); font-size: 16px; }
.rr-done-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: oklch(0.95 0.04 150); color: var(--o-link); }
@media (max-width: 599px) {
  .rr-summary { grid-template-columns: repeat(2, 1fr); }
  .rr-row { flex-wrap: wrap; }
  .rr-seg-row { width: 100%; }
  .rr-seg-row button { flex: 1; justify-content: center; }
  .rr-dialog { place-items: end center; padding: 0; }
  .rr-panel { border-radius: 20px 20px 0 0; max-height: 90dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* Mô tả nút khi rê chuột (modules/hover-tips.js, 16/10/2026): hiện sau đúng 1 giây, thay mô tả của trình duyệt. */
.hover-tip {
  position: fixed;
  z-index: 100040;
  max-width: 280px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--n6-ink, #14161a);
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.4;
  box-shadow: 0 0 0 .5px rgba(24, 30, 52, .14), 0 8px 22px -8px rgba(24, 30, 52, .35);
  pointer-events: none;
  animation: hover-tip-in .12s ease-out;
}
.hover-tip[hidden] { display: none; }
@keyframes hover-tip-in { from { opacity: 0; translate: 0 -2px; } }
@media (prefers-reduced-motion: reduce) { .hover-tip { animation: none; } }

/* Xếp ảnh theo giờ chụp / tên (modules/media-sort-menu.js, 16/10/2026). Ô trung tính; đang xếp khác mặc định thì
   biểu tượng mang màu nhấn và có chấm nhỏ, để khách biết thứ tự đang không theo giờ chụp. */
.top-bar #btn-sort { position: relative; }
.top-bar #btn-sort.is-custom { color: var(--n6-accent); }
.top-bar #btn-sort.is-custom::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--n6-accent);
  box-shadow: 0 0 0 1.5px #fff;
}
.sort-menu {
  position: fixed;
  z-index: 100030;
  min-width: 212px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 0 0 .5px rgba(24, 30, 52, .14), 0 12px 32px -10px rgba(24, 30, 52, .32), 0 2px 6px rgba(24, 30, 52, .06);
  font-family: var(--font-ui);
  animation: sort-menu-in .16s var(--n6-ease);
  transform-origin: top right;
}
@keyframes sort-menu-in { from { opacity: 0; scale: .96; translate: 0 -4px; } }
.sort-menu-heading {
  padding: 6px 10px 6px;
  color: var(--n6-ink-3);
  font-size: 12px;
  font-weight: 600;
}
.sort-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--n6-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sort-menu-item:hover,
.sort-menu-item:focus-visible { background: rgba(37, 99, 235, .07); outline: none; }
.sort-menu-text { display: grid; gap: 1px; flex: 1; }
.sort-menu-label { font-size: 14px; font-weight: 600; }
.sort-menu-hint { color: var(--n6-ink-3); font-size: 12px; }
.sort-menu-check { font-size: 18px; color: var(--n6-accent); visibility: hidden; }
.sort-menu-item[aria-checked="true"] .sort-menu-check { visibility: visible; }
.sort-menu-item[aria-checked="true"] .sort-menu-label { color: var(--n6-accent); }
@media (prefers-reduced-motion: reduce) { .sort-menu { animation: none; } }

/* ── Bảng trạng thái ảnh (17/10/2026: nhân sự và Sơn theo dõi dễ hơn) ──
   Ô số liệu ở đầu; dòng thư mục hai dòng (tên buổi đậm, phần sau + số ảnh + lúc), không cắt chữ, bấm để mở thư mục;
   danh sách ảnh không tạo được bản xem trước kèm lý do và việc cần làm. */
.sync-status-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.sync-status-stat {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  text-align: left;
  color: inherit;
}
.sync-status-stat[hidden] { display: none; }
.sync-status-stat-label { font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); }
.sync-status-stat-value { font-size: 1.125rem; line-height: 1.2; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sync-status-stat-note { font-size: 0.6875rem; color: var(--text-muted); }
.sync-status-stat.is-problem { cursor: pointer; border-color: rgba(201, 72, 40, 0.25); background: #fff6f3; }
.sync-status-stat.is-problem .sync-status-stat-label,
.sync-status-stat.is-problem .sync-status-stat-value { color: var(--o-loi); }
.sync-status-stat.is-problem:hover { background: #ffefe9; }

.sync-status-job-column.is-problems { grid-column: 1 / -1; border-color: rgba(201, 72, 40, 0.22); }
.sync-status-job-column.is-problems[hidden] { display: none; }
.sync-status-job-column.is-problems .sync-status-job-column-head h3 { color: var(--o-loi); }

button.sync-status-job-row,
.sync-status-job-row {
  display: grid;
  gap: 1px;
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  color: inherit;
}
button.sync-status-job-row { cursor: pointer; }
button.sync-status-job-row:hover { background: rgba(37, 99, 235, 0.05); }
.sync-status-job-title {
  font-size: 0.75rem;
  line-height: 1.3;
  font-weight: 650;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.sync-status-job-meta {
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.sync-status-problem-group + .sync-status-problem-group { border-top: 1px solid rgba(0, 0, 0, 0.05); }
.sync-status-problem-files { list-style: none; margin: 0; padding: 0 10px 8px 22px; display: grid; gap: 3px; }
.sync-status-problem-files li { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 0.6875rem; line-height: 1.35; color: var(--text-muted); }
.sync-status-problem-files li strong { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.sync-status-problem-files li.is-more { font-style: italic; }
.derivative-builder-counts { font-size: 0.6875rem; color: var(--text-muted); }

.derivative-builder-copy .derivative-builder-counts { white-space: normal; }

/* Bảng trạng thái mở ra trên mọi cỡ màn hình (Sơn 17/10/2026, máy tính: "không thu gọn được, không thể hiện hết"):
   cao tối đa bằng màn hình, đầu bảng (nút thu gọn) luôn thấy, phần dưới cuộn bên trong; danh sách ảnh lỗi cao vừa phải
   để hai cột "Vừa chuẩn bị xong" / "Đang chờ" vẫn lộ ra. Trước đây chỉ điện thoại có giới hạn này. */
.sync-status-widget.is-expanded {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 36px);
  /* Cao cố định (không theo nội dung): khung neo đáy màn hình, cao theo nội dung thì mỗi lần thêm/bớt dòng đầu bảng
     nhảy lên xuống (Sơn 17/10/2026, video). */
  height: min(860px, calc(100dvh - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 36px));
  overflow: hidden;
}
/* "Đang xử lý" ẩn/hiện theo từng giây; cột "Đang chờ chuẩn bị" đã có cùng thông tin. */
.sync-status-widget.is-expanded .sync-status-row[data-sync-row="target"] { display: none; }
.sync-status-widget.is-expanded .sync-status-main,
.sync-status-widget.is-expanded .sync-status-rows { flex: 0 0 auto; }
.sync-status-widget.is-expanded .sync-status-expanded-panel {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sync-status-job-column.is-problems .sync-status-job-list { max-height: min(34dvh, 360px); }
@media (min-width: 768px) {
  /* Hai cột dưới cao bằng nhau và cố định: cột trống hay đầy không làm khung co giãn. */
  .sync-status-job-column:not(.is-problems) .sync-status-job-list { height: min(40dvh, 420px); max-height: none; }
}

/* Thẻ góp ý gọn hai dòng (Sơn 21/10/2026: "bớt chiếm không gian, ít dòng hơn"): dòng đầu người viết, lúc viết,
   trạng thái; dòng hai lời góp ý, nút nằm bên phải cùng dòng (float: lời dài chảy xuống dưới nút, dùng hết bề ngang).
   "Trả lời" chỉ còn biểu tượng (tên ở title/aria-label). */
.note-main { display: flow-root; margin: 6px 0 0 29px; }
.note-main .note-body { margin: 0; padding-top: 4px; }
.note-main .note-actions { float: right; margin: 0 0 2px 10px; gap: 6px; }
.note-main + .note-replies { margin-top: 6px; }
.note-act.is-icon { padding: 0 8px; }
@media (max-width: 899px) {
  .note-main { margin: 4px 0 0 26px; }
  .note-main .note-actions { margin: 0 0 2px 8px; }
  .note-act.is-icon { padding: 0 7px; }
}

/* Điện thoại: khung góp ý cao cố định suốt lúc góp ý (Sơn 21/10/2026: chuyển ảnh thì ảnh cứ phóng to thu nhỏ,
   "cố định phần này lại"). Trước đây khung cao theo nội dung nên ảnh có thẻ góp ý và ảnh chưa có làm khung ảnh lớn
   co giãn mỗi lần chuyển. Danh sách cuộn bên trong; chỉ lúc mở bàn phím khung mới đổi (has-keyboard). */
@media (max-width: 899px) {
  .note-view:not(.has-keyboard) .note-panel { height: clamp(180px, 30%, 280px); }
  .note-view:not(.has-keyboard) .note-list { flex: 1 1 auto; }
}

/* Bảng tiến độ tải ảnh lên (modules/album-upload.js, 20/11/2026): cùng kiểu thẻ tối với bảng tiến độ ZIP; máy tính để góc
   phải dưới để không chồng bảng ZIP ở giữa, điện thoại trải ngang đáy màn hình. */
.upl-panel {
  position: fixed;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 18px);
  z-index: 9100;
  display: grid;
  gap: 10px;
  width: min(400px, calc(100vw - 32px));
  padding: 12px 12px 12px 14px;
  border-radius: 12px;
  background: #171717;
  color: #fff;
  font-family: var(--font-ui);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}
.upl-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.upl-icon { display: flex; color: #60a5fa; }
.upl-icon .material-symbols-outlined { font-size: 20px; }
.upl-panel:not(.is-busy) .upl-icon { color: #4ade80; }
.upl-panel.has-error .upl-icon { color: #fbbf24; }
.upl-text { display: grid; gap: 2px; min-width: 0; }
.upl-text strong { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.upl-text span { font-size: 12.5px; color: rgba(255, 255, 255, 0.72); font-variant-numeric: tabular-nums; line-height: 1.4; }
.upl-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: 600 13px var(--font-ui);
  cursor: pointer;
}
.upl-btn:hover { background: rgba(255, 255, 255, 0.2); }
.upl-btn:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; }
.upl-close { display: grid; place-items: center; width: 34px; padding: 0; }
.upl-close .material-symbols-outlined { font-size: 18px; }
.upl-bar { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.upl-bar span { display: block; height: 100%; background: #60a5fa; transform-origin: left center; transition: transform 0.3s ease; }
.upl-list { display: grid; gap: 4px; margin: 0; padding: 0 0 0 34px; list-style: none; font-size: 12.5px; }
.upl-list li { display: grid; gap: 1px; min-width: 0; }
.upl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-why { color: rgba(255, 255, 255, 0.64); }
@media (max-width: 767px) {
  .upl-panel { left: 12px; right: 12px; width: auto; }
}

/* Khung thả file khi kéo ảnh từ máy vào trang album (modules/album-upload.js, 21/11/2026). */
.upl-drop {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(37, 99, 235, 0.10);
  border: 3px dashed rgba(37, 99, 235, 0.55);
  pointer-events: none;
}
.upl-drop-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 22px 26px;
  border-radius: 16px;
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font-ui);
  text-align: center;
  box-shadow: 0 20px 50px -20px rgba(24, 30, 52, 0.45);
}
.upl-drop-card .material-symbols-outlined { font-size: 32px; color: var(--accent); }
.upl-drop-card strong { font-size: 16px; font-weight: 650; }
.upl-drop-card span { font-size: 13.5px; color: var(--text-secondary); line-height: 1.45; overflow-wrap: anywhere; }
.upl-hint { margin: 0; padding: 8px 10px 0 34px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 12.5px; line-height: 1.45; color: rgba(255, 255, 255, 0.78); }
.upl-hint strong { color: #fff; font-weight: 600; }
