:root {
  --ink: #0b0b0d;
  --surface: #151518;
  --surface-2: #1d1d22;
  --line: #2a2a31;
  --text: #ededee;
  --muted: #8b8b94;
  --muted-2: #61616a;
  --accent: #cda863;          /* приглушённое золото — отсылка к плёнке/свету */
  --accent-soft: rgba(205, 168, 99, 0.14);
  --danger: #d4756a;
  --ok: #7fb38a;

  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --pad: 16px;
  --radius: 4px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Шапка ─────────────────────────────────────────────── */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) var(--pad) 10px;
  background: linear-gradient(var(--ink), rgba(11, 11, 13, 0.85));
  backdrop-filter: blur(8px);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.42em;
  font-size: 14px;
  padding-left: 0.42em;     /* компенсация трекинга справа */
  color: var(--text);
}

.role-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 10px;
}

/* ── Навигация: вкладки / хлебные крошки ───────────────── */
#navbar {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 46px);
  z-index: 19;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 14px 4px 12px;
  margin-right: 14px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.tab .badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  margin-left: 6px;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px var(--pad);
  min-height: 44px;
}
.crumb-back {
  appearance: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px 4px 0;
  cursor: pointer;
}
.crumb-path {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb-path b { color: var(--text); font-weight: 700; }

/* ── Контент ───────────────────────────────────────────── */
#content {
  padding: var(--pad);
  padding-bottom: calc(env(safe-area-inset-bottom) + 40px);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 2px 0 14px;
}

/* Сетка папок (модели / даты) */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.folder {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.folder img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.92);
  transition: transform 0.4s ease, filter 0.3s ease;
}
.folder:active img { transform: scale(1.03); filter: brightness(1); }
.folder .placard {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 28px 12px 11px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
}
.folder .placard .title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: #fff;
}
.folder .placard .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 3px;
}
.folder .placard .meta .dot { color: var(--accent); margin: 0 5px; }
.folder.empty-cover {
  display: flex; align-items: flex-end;
}
.folder.empty-cover .ghost {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 40px; font-weight: 700;
  color: var(--line);
}

/* Контактный лист (миниатюры фото) */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 3px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
  opacity: 0;
}
.thumb img.loaded { opacity: 1; }
.thumb:active { filter: brightness(1.12); }

/* ── Пустые состояния ─────────────────────────────────── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty .big {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 8px;
}
.empty .small { font-size: 13px; line-height: 1.5; }

/* ── Модерация ─────────────────────────────────────────── */
.mod-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface);
}
.mod-card img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
  display: block;
}
.mod-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
}
.mod-meta b { color: var(--text); }
.mod-actions { display: flex; border-top: 1px solid var(--line); }
.mod-actions button {
  flex: 1;
  appearance: none;
  background: none;
  border: none;
  padding: 14px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.mod-actions .reject { color: var(--danger); }
.mod-actions .approve { color: var(--ok); border-left: 1px solid var(--line); }
.mod-actions button:active { background: var(--surface-2); }

/* ── Доступ (пользователи) ─────────────────────────────── */
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}
.user-info .name { font-size: 14px; color: var(--text); }
.user-info .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 2px;
}
.user-row select {
  appearance: none;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 13px;
}
.user-row .owner-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
}

/* ── Лайтбокс ──────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  user-select: none;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lb-img {
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: contain;
  will-change: transform, opacity;
}
.lb-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 12px;
  z-index: 2;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-close:active { background: rgba(0, 0, 0, 0.7); }
.lb-counter {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.4);
  padding: 5px 12px;
  border-radius: 100px;
}
.lb-counter .cur { color: var(--accent); }
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px; height: 46px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 30px;
  cursor: pointer;
  display: none;            /* показываем только на широких экранах / десктопе */
}
.lb-arrow:hover { color: #fff; }
.lb-prev { left: 4px; }
.lb-next { right: 4px; }
@media (pointer: fine) and (min-width: 600px) {
  .lb-arrow { display: block; }
}

/* ── Splash ────────────────────────────────────────────── */
.splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 10px;
}
.splash-mark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.42em;
  padding-left: 0.42em;
  font-size: 18px;
  color: var(--text);
}
.splash-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-2);
}
.splash.error .splash-sub { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
