:root {
  --bg: #f7efe6;
  --ink: #1c1410;
  --accent: #c45c48;
  --muted: #6b5c52;
  --surface: #fff8f1;
  --ok: #2f9e5c;
  --warn: #d4a017;
  --bad: #c0392b;
  font-family: "PingFang SC", "SF Pro Text", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 90% -20%, #f0d2c4, transparent 55%),
    linear-gradient(180deg, #fbf5ee, var(--bg));
}
.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.app-nav {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  gap: 0;
  order: 2;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  z-index: 40;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 248, 241, 0.98);
  border-top: 1px solid #e6d8c8;
  border-right: 0;
  box-shadow: 0 -4px 16px rgba(28, 20, 16, 0.06);
  pointer-events: auto;
}
.brand {
  display: none;
  margin: 0 8px 16px;
  line-height: 1.25;
}
.brand-title {
  display: block;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}
.brand-sub {
  display: block;
  margin-top: 4px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}
.nav-item {
  flex: 1;
  display: block;
  text-align: center;
  padding: 10px 4px;
  font-size: 13px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.nav-item.active { background: #fff; color: var(--accent); }
.nav-toggle { display: none; }
.content {
  order: 1;
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
}
.page.hidden { display: none; }
.hidden { display: none !important; }
.mine-email-value {
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.mine-password-section { margin-top: 16px; }
.mine-password-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.mine-password-set {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.page-mine:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 120px);
}
.mine-footer {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
h1 { margin: 0 0 6px; font-size: 1.6rem; }
.muted { color: var(--muted); font-size: 13px; }

/* —— 账号登录（App 风格） —— */
.auth-screen {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 8px;
}
.auth-lang-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}
.auth-lang-row .field-label {
  margin: 0;
}
.lang-select {
  max-width: 160px;
  font-size: 14px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ebe0d4;
  border-radius: 20px;
  padding: 24px 20px 18px;
  box-shadow: 0 12px 40px rgba(28, 20, 16, 0.08);
}
.auth-header { text-align: center; margin-bottom: 20px; }
.auth-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: block;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(196, 92, 72, 0.35);
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(28, 20, 16, 0.08);
}
.brand-text {
  min-width: 0;
}
.auth-title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.auth-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.segmented {
  display: flex;
  gap: 0;
  padding: 4px;
  background: #f0e6da;
  border-radius: 12px;
  margin-bottom: 18px;
}
.segmented-item {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
}
.segmented-item.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(28, 20, 16, 0.08);
}

.auth-tab-panels {
  margin-top: 4px;
}

.auth-tab-panel {
  animation: authFade 0.2s ease;
}

@keyframes authFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-downloads-link {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--accent, #c45c26);
  text-decoration: none;
}
.auth-downloads-link:hover {
  text-decoration: underline;
}
.downloads-card .download-link {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 10px;
}
.download-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.download-history {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e6d8c8;
}
.download-history-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
}
.download-history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.download-recommend {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e7f6ec;
  color: #1d7a3a;
  font-size: 12px;
  font-weight: 600;
}
.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-tab-lead {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.btn-register {
  background: var(--ink);
  box-shadow: 0 4px 14px rgba(28, 20, 16, 0.2);
}
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.field input {
  margin-top: 0;
}
.field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-row input { flex: 1; min-width: 0; }
.btn-send-code {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 12px;
}
.btn-primary { background: var(--accent); color: #fff; border: 0; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid #e0d2c2;
}
.auth-logout { margin-top: 8px; }
.auth-status {
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
  background: #f5ebe2;
  border: 0;
}
.conn-line {
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
}
.conn-line.ok { color: var(--ok); }
.conn-line.warn { color: var(--warn); }
.conn-line.bad { color: var(--bad); }
.ad-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #e8d9c8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ad-banner.hidden { display: none; }
.benefit-grid {
  display: grid;
  gap: 12px;
  margin: 20px 0 8px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .benefit-grid { grid-template-columns: 1fr 1fr; }
}
.benefits-hero {
  padding: 8px 0 4px;
}
.benefits-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2rem);
  letter-spacing: -0.02em;
}
.benefits-empty { margin: 24px 0; text-align: center; }
.benefit-card {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background:
    linear-gradient(145deg, #fffdf9 0%, var(--surface) 55%, #f7ebe3 100%);
  padding: 16px 18px;
  border-radius: 16px;
  line-height: 1.5;
  border: 1.5px solid #eadfd4;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  position: relative;
  box-shadow: 0 8px 24px rgba(28, 20, 16, 0.04);
}
.benefit-card:hover {
  border-color: #dfc2b2;
  transform: translateY(-1px);
}
.benefit-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 10px 28px rgba(196, 92, 72, 0.12);
}
.benefit-card.is-unavailable {
  opacity: 0.5;
  filter: grayscale(0.35);
  cursor: pointer;
}
.benefit-card.is-unavailable.is-selected {
  opacity: 0.72;
  filter: grayscale(0.2);
}
.benefit-card.is-free .benefit-price { color: var(--ok); }
.benefit-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.benefit-card-top strong { font-size: 15px; }
.benefit-card .benefit-phase {
  flex-shrink: 0;
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #ebe4dc;
  color: var(--muted);
}
.benefit-card .benefit-phase.is-live {
  background: #e4f2e8;
  color: var(--ok);
}
.benefit-card .benefit-price {
  margin: 10px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent, #c45c48);
}
.benefit-card.is-selected .benefit-price {
  font-size: 24px;
  color: var(--ok, #2f9e5c);
}
.benefit-detail .benefit-detail-price {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ok, #2f9e5c);
  letter-spacing: -0.02em;
}
.benefit-card-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.benefit-detail {
  margin: 4px 0 16px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background:
    radial-gradient(420px 160px at 100% 0%, #f0d5c8, transparent 60%),
    linear-gradient(165deg, #fff9f4, var(--surface));
  border: 1px solid #ead9cc;
  line-height: 1.55;
  animation: benefit-detail-in 0.22s ease;
}
@keyframes benefit-detail-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.benefit-detail h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.02em; }
.benefit-detail .benefit-detail-meta { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.benefit-checkout {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, var(--bg) 32%);
  display: grid;
  gap: 8px;
}
.benefit-checkout .btn-block { width: 100%; border-radius: 14px; padding: 14px 16px; font-weight: 700; }
.benefit-checkout .btn-block:disabled { opacity: 0.45; }
.subhead { margin: 16px 0 8px; font-size: 15px; }
label { display: block; margin: 10px 0; font-size: 14px; }
.connect-addr { display: block; margin: 10px 0; font-size: 14px; }
.connect-addr-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 6px;
}
.connect-addr-row input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin-top: 0;
}
.connect-addr-row #btnScanQr {
  flex: 0 0 auto;
  white-space: nowrap;
}
input, textarea, select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #e0d2c2;
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
select { width: auto; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid #e0d2c2; }
.log {
  background: var(--surface);
  padding: 10px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
}
.connect-info {
  margin: 10px 0 14px;
  padding: 0;
  background: transparent;
  border: 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  font-family: inherit;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.list-sticky-spacer {
  width: 100%;
  height: 0;
  flex-shrink: 0;
  pointer-events: none;
}
.content:has(#page-photos:not(.hidden)) {
  padding-top: 6px;
}
#page-photos.sticky-list-page:not(.hidden) {
  margin-top: -6px;
}
#page-photos:not(.hidden) .list-sticky-bar {
  padding: 4px 12px 6px;
}
#page-photos:not(.hidden) .list-sticky-panel {
  gap: 4px;
}
#page-photos:not(.hidden) .toolbar-photo-bar button {
  padding: 6px 10px;
}
.sticky-list-page:not(.hidden) .list-sticky-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 920px;
  z-index: 32;
  margin: 0;
  padding: 10px 16px 12px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(251, 245, 238, 0.98), rgba(247, 239, 230, 0.94));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(224, 210, 194, 0.85);
  box-shadow: 0 6px 14px rgba(28, 20, 16, 0.06);
  pointer-events: auto;
}
.list-sticky-bar {
  position: relative;
  z-index: 28;
  margin: -4px 0 12px;
  padding: 8px 0 10px;
}
.list-sticky-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.list-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 14px !important;
  color: var(--muted);
  font-size: 13px;
  background: transparent !important;
}
.list-loading .thumb-spin {
  width: 22px;
  height: 22px;
  border-width: 2px;
}
.photo-grid-loading {
  grid-column: 1 / -1;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar-row::-webkit-scrollbar { display: none; }
.toolbar-row .check {
  flex-shrink: 0;
  padding-right: 2px;
}
.toolbar-row button,
.toolbar-row select {
  flex-shrink: 0;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.toolbar-pager {
  justify-content: flex-start;
}
.toolbar-pager select {
  min-width: 5.5rem;
}
.toolbar-photo-bar {
  align-items: center;
  gap: 8px;
}
.toolbar-photo-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar-photo-actions::-webkit-scrollbar { display: none; }
.toolbar-photo-actions.hidden { display: none !important; }
.photo-list-footer-spacer {
  width: 100%;
  height: 0;
  flex-shrink: 0;
  pointer-events: none;
}
#page-photos:not(.hidden) .photo-list-footer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 920px;
  z-index: 38;
  bottom: calc(54px + env(safe-area-inset-bottom, 0px));
  margin-top: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid rgba(232, 221, 208, 0.95);
  background: linear-gradient(180deg, rgba(255, 248, 241, 0.97), rgba(247, 239, 230, 0.96));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -6px 16px rgba(28, 20, 16, 0.08);
  box-sizing: border-box;
}
.photo-list-footer {
  margin-top: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e8ddd0;
  background: rgba(255, 248, 241, 0.92);
}
.photo-list-footer .toolbar-row + .toolbar-row {
  margin-top: 8px;
}
.photo-pager-row {
  justify-content: space-between;
}
.photo-pager-center {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.photo-pager-field {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 4px 6px;
}
.photo-pager-input {
  width: 3.25rem;
  max-width: 40vw;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--ink);
  border: 1px solid #e0d2c2;
  border-radius: 8px;
  background: #fff;
}
.photo-pager-input:focus {
  outline: 2px solid rgba(196, 92, 72, 0.35);
  outline-offset: 1px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.photo-meta-row {
  justify-content: space-between;
  gap: 8px;
}
.photo-meta-total {
  flex: 1 1 auto;
  min-width: 4.5rem;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.photo-meta-row #photoPageSize {
  min-width: 5.5rem;
  flex-shrink: 0;
}
.photo-meta-row #photoSort {
  min-width: 7rem;
  max-width: 10rem;
  flex: 1 1 auto;
}
.list-sticky-expand {
  display: none;
  width: 40px;
  height: 28px;
  margin: 0 auto;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #e0d2c2;
  background: rgba(255, 248, 241, 0.96);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(28, 20, 16, 0.08);
  cursor: pointer;
}
.sticky-list-page:not(.hidden) .list-sticky-bar.is-collapsed {
  padding: 6px 16px 8px;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}
.list-sticky-bar.is-collapsed .list-sticky-panel {
  display: none;
}
.list-sticky-bar.is-collapsed .list-sticky-expand {
  display: flex;
  align-items: center;
  justify-content: center;
}
.check { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.check input { width: auto; margin: 0; }
.file-list, .member-list { list-style: none; padding: 0; margin: 0; }
.file-list li {
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.file-list .upload-row {
  justify-content: center;
  border: 1.5px dashed #c45c48;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}
.member-list li {
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.member-list .drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 18px;
  margin-right: 4px;
  user-select: none;
}
.member-list.fixed-mode li { cursor: grab; }
.member-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.file-list li.uploading-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.upload-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  width: 100%;
}
.upload-meta .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.upload-meta .stats { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-track {
  height: 7px;
  background: #e8d9c8;
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.photo-cell.uploading .upload-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  background: linear-gradient(transparent 30%, rgba(28, 20, 16, 0.72));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
}
.photo-cell.uploading .progress-track { background: rgba(255,255,255,0.35); }
.photo-cell.uploading .progress-fill { background: #fff; }
.photo-cell.uploading .upload-veil .stats {
  opacity: 0.95;
  white-space: normal;
  line-height: 1.35;
  word-break: break-all;
}
.upload-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.upload-act {
  padding: 4px 10px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
}
.upload-act-danger {
  color: var(--bad) !important;
  border-color: #e8b4b0 !important;
}
.photo-cell.uploading .upload-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  margin: 0;
}
.photo-cell.uploading .upload-act {
  background: rgba(255, 248, 241, 0.92);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 4px 8px !important;
  font-size: 11px !important;
}
.photo-cell.upload-paused .upload-veil {
  background: linear-gradient(transparent 10%, rgba(28, 20, 16, 0.82));
}
#page-photos:not(.hidden) .photo-grid {
  margin-top: 0;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}
.photo-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #e8d9c8;
}
.photo-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: transparent;
}
.photo-cell img.thumb-ready { opacity: 1; }
.photo-cell img:not(.thumb-ready) {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8d9c8;
  z-index: 0;
}
.thumb-placeholder.hidden { display: none !important; }
.thumb-spin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(28, 20, 16, 0.12);
  border-top-color: var(--accent);
  animation: thumb-spin 0.75s linear infinite;
}
@keyframes thumb-spin {
  to { transform: rotate(360deg); }
}
.thumb-broken {
  width: 44px;
  height: 44px;
  opacity: 0.55;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none'%3E%3Cpath d='M8 44V14a4 4 0 0 1 4-4h28l12 12v22a4 4 0 0 1-4 4H12a4 4 0 0 1-4-4z' stroke='%236b5c52' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M40 10v10h10' stroke='%236b5c52' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M14 40l12-14 8 8 6-6 10 12' stroke='%236b5c52' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M22 18l20 28M42 18L22 46' stroke='%23c45c48' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.photo-time {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 16px 5px 5px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  text-align: center;
  background: linear-gradient(transparent, rgba(28, 20, 16, 0.78));
  pointer-events: none;
}
.photo-time div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-name-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.file-name-block .file-name {
  word-break: break-all;
}
.file-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.dl-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(47, 158, 92, 0.15);
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.photo-cell .dl-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  margin: 0;
  z-index: 1;
  background: rgba(47, 158, 92, 0.92);
  color: #fff;
}
.photo-cell .media-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(20, 16, 12, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}
.photo-cell .pick {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
}
.photo-grid:not(.select-mode) .photo-cell .pick {
  display: none;
}
.photo-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed #c45c48;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
}
.local-upload-bar {
  margin: 8px 12px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid #e8c4b8;
}
.local-upload-bar.hidden { display: none; }
.local-upload-text {
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 4px;
  word-break: break-all;
}
.local-upload-stats {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.local-upload-stats.hidden { display: none; }
.local-upload-bar .ghost { margin-top: 8px; }
.sheet {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface);
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 13px;
}
.priority-sync-bar {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff8f1;
  border: 1px solid #e8c4b8;
}

.priority-sync-bar.hidden {
  display: none !important;
}

.priority-sync-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.priority-sync-actions {
  margin: 0;
  gap: 10px;
}

.priority-sync-actions .btn-primary {
  flex: 1;
}

.priority-sync-bar.is-syncing {
  opacity: 0.85;
  pointer-events: none;
}

.cluster-status {
  font-weight: 700;
  color: var(--ok);
}
.cluster-status.ok { color: var(--ok); }
.cluster-status.warn { color: var(--warn); }
.cluster-status.bad { color: #9a9a9a; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot.green { background: var(--ok); }
.dot.yellow { background: var(--warn); }
.dot.red { background: var(--bad); }
.dot.gray { background: #9a9a9a; }
.hidden-input { display: none; }
dialog {
  border: 0;
  border-radius: 12px;
  padding: 20px;
  background: var(--surface);
}
.object-detail-actions button.hidden { display: none; }
.action-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}
.action-sheet button { width: 100%; }
.media-viewer {
  padding: 0;
  border: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: #000;
}
.media-viewer::backdrop { background: #000; }
.media-viewer-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 60dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-viewer-inner img,
.media-viewer-inner video {
  max-width: 100%;
  max-height: 100%;
  max-height: 100dvh;
  object-fit: contain;
}
.media-viewer-inner .hidden { display: none !important; }
.media-viewer-loading,
.media-viewer-error {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  background: #000;
}
.media-viewer-loading.hidden,
.media-viewer-error.hidden { display: none !important; }
.media-viewer-spin {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: thumb-spin 0.75s linear infinite;
}
.media-viewer-loading-text,
.media-viewer-error-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  max-width: 16rem;
  color: rgba(255, 255, 255, 0.82);
}
.media-viewer-error .thumb-broken {
  width: 56px;
  height: 56px;
  opacity: 0.85;
  filter: brightness(1.4);
}
.media-viewer-retry {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}
.media-viewer-kind {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.26);
  color: rgba(255, 255, 255, 0.96);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.media-viewer-kind.hidden { display: none !important; }
.media-viewer-close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.media-viewer-fab {
  position: absolute;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.file-list li.download-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.file-list li.download-row.done { opacity: 0.95; }

@media (min-width: 960px) {
  .shell {
    --nav-w: 168px;
    flex-direction: row;
    align-items: stretch;
  }
  .shell.nav-collapsed { --nav-w: 0px; }
  .app-nav {
    order: -1;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    width: var(--nav-w);
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 20px 12px;
    border-top: 0;
    border-right: 1px solid #e6d8c8;
    box-shadow: none;
    overflow: hidden;
    transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
  }
  .shell.nav-collapsed .app-nav {
    padding-left: 0;
    padding-right: 0;
    border-right-color: transparent;
  }
  .nav-toggle {
    display: block;
    margin-top: auto;
    width: 100%;
    background: transparent;
    color: var(--ink);
    border: 1px solid #e0d2c2;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    white-space: nowrap;
  }
  .shell.nav-collapsed .nav-toggle {
    position: fixed;
    left: 12px;
    bottom: 16px;
    z-index: 45;
    width: auto;
    margin-top: 0;
    background: rgba(255, 248, 241, 0.98);
    box-shadow: 0 4px 14px rgba(28, 20, 16, 0.12);
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 16px;
    padding: 0 4px;
    text-align: left;
  }
  .brand-title,
  .brand-sub {
    text-align: left;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
  }
  .nav-item {
    flex: none;
    text-align: left;
    padding: 12px 14px;
    font-size: 15px;
  }
  .content {
    order: 0;
    flex: 1;
    min-width: 0;
    padding: 24px 20px 40px;
  }
  .sticky-list-page:not(.hidden) .list-sticky-bar {
    left: var(--nav-w);
    right: 0;
    width: auto;
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
    transform: none;
    padding-left: 20px;
    padding-right: 20px;
    transition: left 0.2s ease;
  }
  #page-photos:not(.hidden) .photo-list-footer {
    left: var(--nav-w);
    right: 0;
    width: auto;
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
    transform: none;
    padding-left: 20px;
    padding-right: 20px;
    bottom: 0;
    transition: left 0.2s ease;
  }
}
