/* PhotoVault design system — shared by the admin panel, the user portal and share links.
   Photo-first: quiet warm neutrals, one indigo accent, generous radius, light + dark. */
:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #efeeea; --text: #1a1b1e; --muted: #6a6d75; --line: #e3e1db;
  --accent: #4a56d4; --accent-ink: #ffffff; --accent-soft: #e9ebff; --accent-line: #c9ceff;
  --danger: #d1352e; --danger-soft: #fdecea; --ok: #1d9a60; --ok-soft: #e4f6ec; --warn: #a96a0b; --warn-soft: #fcf1dc;
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .06), 0 1px 1px rgba(20, 20, 30, .04);
  --shadow: 0 6px 24px rgba(20, 20, 40, .10), 0 2px 6px rgba(20, 20, 40, .06);
  --shadow-lg: 0 24px 64px rgba(10, 10, 30, .28);
  --r: 14px; --r-sm: 10px; --r-xs: 7px; --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12; --surface: #17181c; --surface-2: #202127; --text: #ececef; --muted: #9b9ea8; --line: #2a2b32;
    --accent: #8d95ff; --accent-ink: #0e0f12; --accent-soft: #23264d; --accent-line: #3a3f86;
    --danger: #ff6b63; --danger-soft: #3a1c1b; --ok: #4fd18c; --ok-soft: #14301f; --warn: #f0b24a; --warn-soft: #3a2c10;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5); --shadow: 0 8px 28px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f12; --surface: #17181c; --surface-2: #202127; --text: #ececef; --muted: #9b9ea8; --line: #2a2b32;
  --accent: #8d95ff; --accent-ink: #0e0f12; --accent-soft: #23264d; --accent-line: #3a3f86;
  --danger: #ff6b63; --danger-soft: #3a1c1b; --ok: #4fd18c; --ok-soft: #14301f; --warn: #f0b24a; --warn-soft: #3a2c10;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5); --shadow: 0 8px 28px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum"; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.01em; font-weight: 650; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { display: block; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; } .gap-s { gap: 6px; } .gap-l { gap: 18px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.s { width: 15px; height: 15px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
  font-weight: 550; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, .tile:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); } .btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: 38px; padding: 0; } .btn.icon.sm { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.input, .select {
  height: 40px; width: 100%; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.select { width: auto; padding-right: 30px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; } .field > label { font-weight: 550; font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.pw { position: relative; } .pw .input { padding-right: 84px; }
.pw .tools { position: absolute; right: 4px; top: 4px; display: flex; gap: 2px; }
.check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ---------- chips, badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 520; user-select: none; transition: .15s;
}
.chip:hover { border-color: var(--accent-line); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip .dot, .tag .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tagc, var(--accent)); }
.filters { display: flex; flex-direction: column; gap: 12px; }
.only-m { display: none; }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 11px; }
.seg button { flex: none; white-space: nowrap; border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); } .badge.accent { background: var(--accent-soft); color: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 580; background: color-mix(in srgb, var(--tagc, var(--accent)) 14%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--tagc, var(--accent)) 35%, transparent); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand .logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ff7ab8)); }
.nav { display: flex; align-items: center; gap: 11px; padding: 0 12px; height: 40px; border-radius: 10px; color: var(--text); font-weight: 550; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.nav:hover { background: var(--surface-2); text-decoration: none; }
.nav .nlabel { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { gap: 10px; }
.nav.on { background: var(--accent-soft); color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.nav.on .count { background: var(--accent); color: var(--accent-ink); }
.nav .count.alert { background: var(--warn-soft); color: var(--warn); }
.side .spacer { flex: 1; }
.stat { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.stat b { color: var(--text); font-weight: 650; }
.main { padding: 28px clamp(16px, 3vw, 40px) 120px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.toolbar .search { position: relative; flex: 1 1 260px; min-width: 200px; }
.toolbar .search .input { padding-left: 38px; } .toolbar .search svg { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.flabel { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }

/* ---------- group cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-line); }
.mosaic { position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; aspect-ratio: 16 / 11; background: var(--surface-2); overflow: hidden; }
.mosaic.m1 { grid-template: 1fr / 1fr; } .mosaic.m2 { grid-template: 1fr / 1fr 1fr; } .mosaic.m3 > :first-child { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .mosaic img { transform: scale(1.05); }
.mosaic .empty-m { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; color: var(--muted); }
.mosaic .shade { position: absolute; inset: auto 0 0 0; height: 46%; background: linear-gradient(transparent, rgba(0, 0, 0, .55)); pointer-events: none; }
.mosaic .kinds { position: absolute; left: 10px; bottom: 9px; display: flex; gap: 8px; color: #fff; font-size: 12.5px; font-weight: 650; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.mosaic .kinds span { display: inline-flex; gap: 5px; align-items: center; }
.mosaic .flags { position: absolute; right: 8px; top: 8px; display: flex; gap: 5px; }
.flag { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(0, 0, 0, .5); color: #fff; backdrop-filter: blur(6px); }
.flag.warn { background: rgba(190, 120, 10, .85); }
.card .body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; }
.card .title { font-weight: 650; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.card .title.unnamed { color: var(--muted); font-style: italic; font-weight: 550; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .tags { display: flex; gap: 5px; flex-wrap: wrap; min-height: 0; }
.card.system { border-style: dashed; background: var(--surface-2); }

/* ---------- photo grid ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-xs); background: var(--surface-2); cursor: zoom-in; border: 0; padding: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease), opacity .2s; }
.tile:hover img { transform: scale(1.04); }
.tile .pick { position: absolute; left: 7px; top: 7px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .25); display: grid; place-items: center; color: transparent; opacity: 0; transition: .15s; cursor: pointer; backdrop-filter: blur(4px); }
.tile:hover .pick, .selecting .tile .pick { opacity: 1; }
.tile.sel { box-shadow: 0 0 0 3px var(--accent); } .tile.sel img { transform: scale(.94); border-radius: 8px; }
.tile.sel .pick { opacity: 1; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile.dim img { opacity: .4; }
.tile .lbl { position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 600; }
.tile .play { position: absolute; right: 7px; bottom: 7px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; }
.tile .cap { position: absolute; inset: 0 0 auto 0; padding: 18px 8px 4px; font-size: 11.5px; line-height: 1.25; color: #fff; background: linear-gradient(rgba(0, 0, 0, .65), transparent); opacity: 0; transition: .2s; pointer-events: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile:hover .cap { opacity: 1; }

/* ---------- selection bar, modal, toast ---------- */
.selbar { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); padding: 10px 12px; background: var(--text); color: var(--bg); border-radius: 16px; box-shadow: var(--shadow-lg); transition: transform .3s var(--ease); }
.selbar.show { transform: translate(-50%, 0); }
.selbar .btn { background: transparent; border-color: color-mix(in srgb, var(--bg) 28%, transparent); color: var(--bg); box-shadow: none; }
.selbar .btn:hover { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.selbar .btn.danger { color: #ff9a94; } .selbar .count { font-weight: 650; padding: 0 8px; }
.overlay { position: fixed; inset: 0; z-index: 90;   /* above the lightbox (70): dialogs opened from it must be reachable */ display: grid; place-items: center; padding: 16px; background: rgba(10, 10, 20, .5); backdrop-filter: blur(5px); animation: fade .18s ease; }
.modal { width: min(560px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); overflow: hidden; }
.modal.wide { width: min(720px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; }
.modal .content { padding: 4px 20px 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; background: var(--surface); text-align: left; width: 100%; }
.pick-item:hover { border-color: var(--accent-line); background: var(--surface-2); }
.pick-item.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-item .mini { width: 52px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; }
.callout.warn { background: var(--warn-soft); } .callout.danger { background: var(--danger-soft); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-weight: 520; animation: pop .25s var(--ease); max-width: 360px; }
.toast.bad { background: var(--danger); color: #fff; }
.menu { position: absolute; z-index: 95; min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); animation: pop .15s var(--ease); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 11px; border: 0; border-radius: 9px; background: none; cursor: pointer; text-align: left; font-weight: 520; }
.menu button:hover { background: var(--surface-2); } .menu button.danger { color: var(--danger); } .menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

/* ---------- users ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
.li { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.li:last-child { border-bottom: 0; } .li:hover { background: var(--surface-2); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; background: hsl(var(--h, 230) 55% 52%); }
.avatar.big { width: 64px; height: 64px; font-size: 24px; }

/* ---------- empty / login ---------- */
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .6; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(400px, 100%); padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.login-card .brand { padding: 0; }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 70; background: rgba(6, 6, 10, .94); display: none; align-items: center; justify-content: center; animation: fade .2s; }
.lb.on { display: flex; }
.lb .stage { max-width: 96vw; max-height: 90vh; display: grid; place-items: center; }
.lb img, .lb video { max-width: 96vw; max-height: 88vh; border-radius: 6px; box-shadow: 0 10px 60px rgba(0, 0, 0, .6); }
.lb .nav-b { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.lb .nav-b:hover { background: rgba(255, 255, 255, .24); } .lb .prev { left: 16px; } .lb .next { right: 16px; }
.lb .top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: #fff; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.lb .top .grow { font-size: 14px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .top .btn { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; box-shadow: none; }
.lb .caption { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); max-width: 90vw; padding: 8px 14px; border-radius: 12px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; }

/* ---------- public gallery ---------- */
.pub { max-width: 1280px; margin: 0 auto; padding: 36px clamp(14px, 3vw, 32px) 60px; }
.pub-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.pub .tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; } .pub .tile { border-radius: 10px; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 40px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- phones ---------- */
@media (max-width: 860px) {
  .only-m { display: inline-flex; } .filters:not(.open) { display: none; }
  .flabel { width: 100%; margin: 2px 0 -4px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); gap: 2px; justify-content: space-around; }
  .side .brand, .side .stat, .side .spacer, .side .hide-m { display: none; }
  .nav { flex-direction: column; gap: 2px; height: 52px; justify-content: center; font-size: 11px; padding: 0 8px; width: auto; flex: 1; text-align: center; position: relative; }
  .nav .nlabel { flex: none; font-size: 11px; }
  .nav .count { position: absolute; top: 3px; right: 18%; margin: 0; font-size: 10px; padding: 0 5px; }
  .main { padding: 18px 14px 150px; } h1 { font-size: 22px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; }
  .selbar { bottom: 74px; } .toasts { bottom: 80px; right: 12px; }
  .modal { max-height: 92vh; border-radius: 18px; }
}


/* ---------- phone layout for the people-facing pages ---------- */
@media (max-width: 860px) {
  .pub { padding: 18px 12px 120px; }
  .pub .tiles { grid-template-columns: repeat(3, 1fr); gap: 3px; }          /* 3 across like a phone gallery, not one huge picture */
  .pub .tile { border-radius: 4px; }
  .hide-m { display: none !important; }
  .btn .t { display: none; }                                                /* header buttons become icon-only */
  .btn.sm:has(> .t) { width: 40px; padding: 0; }
}
@media (max-width: 380px) { .pub .tiles { grid-template-columns: repeat(2, 1fr); } }

/* ---------- touch devices ---------- */
@media (pointer: coarse) {
  .btn { height: 44px; } .btn.sm { height: 40px; } .btn.icon { width: 44px; } .btn.icon.sm { width: 40px; }
  .input, .select { height: 46px; font-size: 16px; }              /* >=16px stops iOS from zooming into the field */
  .chip { height: 36px; } .seg button { height: 36px; } .check { width: 22px; height: 22px; }
  .tile .pick { opacity: 1; width: 26px; height: 26px; }
}
/* dialogs become bottom sheets on phones */
@media (max-width: 860px) {
  .overlay { align-items: end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: sheet .28s var(--ease); }
  .modal footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- uploading ---------- */
.fab { position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 25; height: 56px; padding: 0 22px 0 18px; border-radius: 28px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: var(--accent-ink); background: var(--accent); box-shadow: var(--shadow); }
.fab:active { transform: scale(.97); } .fab svg.i { width: 22px; height: 22px; }
.bigbtns { display: grid; grid-template-columns: 1fr; gap: 10px; }
.bigbtn { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-align: left; font-weight: 600; font-size: 16px; }
.bigbtn:hover { border-color: var(--accent-line); background: var(--surface-2); } .bigbtn .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.bigbtn .sub { font-weight: 450; font-size: 13px; color: var(--muted); }
.urow { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.urow .thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.urow .thumb img { width: 100%; height: 100%; object-fit: cover; }
.urow .name { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; } .bar > i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.bar.ok > i { background: var(--ok); } .bar.bad > i { background: var(--danger); } .bar.warn > i { background: var(--warn); }
.ulist { display: flex; flex-direction: column; max-height: 46vh; overflow: auto; }
.tile .mine { position: absolute; left: 6px; top: 6px; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 650; }
.tile .by { position: absolute; right: 6px; top: 6px; max-width: 70%; padding: 1px 7px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.has-pick .by { top: 36px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
