:root {
  --bg: #ffffff;
  --bg-2: #f3f4f6;
  --bg-3: #e7e9ee;
  --fg: #1d1f24;
  --fg-2: #5d6270;
  --line: #e0e3e9;
  --accent: #3a6ff7;
  --accent-fg: #ffffff;
  --danger: #d33a2c;
  --prov: #c27c0e;
  --ok: #1f9d55;
  --shadow: 0 8px 30px rgba(0, 0, 0, .12);
  --radius: 10px;
  --top-h: 56px;
  --bottom-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a; --bg-2: #202227; --bg-3: #2b2e35; --fg: #eceef2; --fg-2: #a2a7b3; --line: #30333b;
    --accent: #7ea2ff; --accent-fg: #0e1220; --danger: #ff6b5e; --prov: #f0b44c; --ok: #4cd38a; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16171a; --bg-2: #202227; --bg-3: #2b2e35; --fg: #eceef2; --fg-2: #a2a7b3; --line: #30333b;
  --accent: #7ea2ff; --accent-fg: #0e1220; --danger: #ff6b5e; --prov: #f0b44c; --ok: #4cd38a; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lb-lock { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
input[type="text"], input[type="search"], input[type="password"], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea { resize: vertical; min-height: 44px; }
button, .button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); cursor: pointer; text-decoration: none; color: var(--fg); white-space: nowrap; min-height: 38px;
}
button:hover:not(:disabled), .button:hover { background: var(--bg-3); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
button.danger { color: var(--danger); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { padding: 8px; border: 0; background: transparent; border-radius: 999px; min-height: 40px; min-width: 40px; justify-content: center; }
.icon-btn:hover:not(:disabled) { background: var(--bg-3); }
.muted { color: var(--fg-2); }
.error { color: var(--danger); }
.spacer { flex: 1; }
.boot { padding: 40vh 0; text-align: center; color: var(--fg-2); }
[hidden] { display: none !important; }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 12px; text-align: center; padding: 28px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { margin: 0; }
.login-card button { justify-content: center; }
.login-logo .icon { width: 44px; height: 44px; color: var(--accent); }

/* ---------- top bar & navigation ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 600; font-size: 17px; }
.brand .icon { color: var(--accent); }
.search { position: relative; flex: 1; max-width: 640px; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 10px; color: var(--fg-2); width: 18px; height: 18px; }
.search input { padding-left: 34px; background: var(--bg-2); border-color: transparent; border-radius: 999px; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; list-style: none; margin: 0; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.suggest li small { color: var(--fg-2); font-size: 12px; min-width: 46px; }
.suggest li:hover, .suggest li.active { background: var(--bg-2); }
.dlg-body .suggest { position: static; margin-top: 4px; box-shadow: none; max-height: 30vh; }
nav.side { display: flex; gap: 2px; }
nav.side a, nav.bottom a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: var(--fg-2); text-decoration: none; font-size: 14px; }
nav.side a.active, nav.bottom a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
nav.side a .icon { width: 20px; height: 20px; }
nav.bottom { display: none; }
.me { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 999px; justify-content: center; background: var(--accent); color: var(--accent-fg); border: 0; font-weight: 600; flex: none; }

@media (max-width: 860px) {
  :root { --bottom-h: 60px; }
  .brand span { display: none; }
  nav.side { display: none; }
  nav.bottom {
    display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--bg); border-top: 1px solid var(--line);
  }
  nav.bottom a { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; white-space: nowrap; justify-content: center; border-radius: 0; background: none !important; }
  .top { padding: 0 12px; gap: 8px; }
}

/* ---------- photos view ---------- */
.photos-head { position: sticky; top: var(--top-h); z-index: 10; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); padding: 6px 16px 4px; }
.chips-bar, .jump-bar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.chips-bar::-webkit-scrollbar, .jump-bar::-webkit-scrollbar { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg); white-space: nowrap; font-size: 14px; text-decoration: none; }
.fchip button { border: 0; background: none; min-height: 0; padding: 0 6px; font-size: 17px; line-height: 1; color: var(--fg-2); }
.suggest-chip { padding-right: 12px; background: color-mix(in srgb, var(--prov) 18%, transparent); }
.tools { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.tools .count { color: var(--fg-2); font-size: 14px; }
.tool { background: none; border: 0; padding: 6px 8px; min-height: 34px; color: var(--fg-2); font-size: 14px; }
.tool .icon { width: 18px; height: 18px; }
.jump-bar button { padding: 3px 10px; min-height: 28px; border-radius: 999px; font-size: 13px; background: var(--bg-2); border: 0; color: var(--fg-2); }
.callout { margin: 8px 16px; padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--prov) 14%, transparent); }

.grid-wrap { padding: 0 16px 40px; }
@media (max-width: 600px) { .grid-wrap { padding: 0 2px 30px; } .photos-head { padding: 4px 10px 2px; } }
.sec-head { display: flex; align-items: baseline; gap: 10px; padding: 18px 2px 8px; }
.sec-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sec-head .count { color: var(--fg-2); font-size: 13px; }
.row { display: flex; gap: 3px; margin-bottom: 3px; contain: layout paint; }
.tile { position: relative; padding: 0; border: 0; border-radius: 0; min-height: 0; background: var(--bg-2); overflow: hidden; cursor: pointer; flex: none; height: 100%; -webkit-touch-callout: none; user-select: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s ease; }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.badge.prov { position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-radius: 9px; background: var(--prov); box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.badge.del { position: absolute; left: 6px; top: 6px; font-size: 14px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tile.flagged img { opacity: .55; }
.check { display: none; position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 22px; border: 2px solid #fff; background: rgba(0,0,0,.25); }
.selecting .check { display: block; }
.tile.selected img { transform: scale(.88); }
.tile.selected .check { background: var(--accent); border-color: var(--accent); }
.tile.selected .check::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.empty { color: var(--fg-2); text-align: center; padding: 60px 0; }

.selbar {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom-h) + 12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); width: min(640px, calc(100% - 16px));
}
.selbar .icon { width: 18px; height: 18px; }
@media (max-width: 600px) { .selbar button span { display: none; } }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; color: #fff; }
.lb-main { position: relative; flex: 1; min-width: 0; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; display: grid; place-items: center; }
.lb-stage img { grid-area: 1 / 1; max-width: 100%; max-height: 100%; object-fit: contain; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; transition: transform .2s ease; }
.lb-stage.zoomed img { transition: none; cursor: grab; }
.lb-img { opacity: 0; }
.lb-img.ready { opacity: 1; }
.lb-thumb { filter: blur(2px); }
.lb-stage:has(.lb-img.ready) .lb-thumb { visibility: hidden; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), transparent); }
.lb-top .icon-btn { color: #fff; }
.lb-top .icon-btn:hover { background: rgba(255,255,255,.15); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; background: rgba(0,0,0,.35) !important; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 16px max(14px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; pointer-events: none; }
.lb-caption:empty { display: none; }
.lb-info { width: 380px; flex: none; background: var(--bg); color: var(--fg); overflow-y: auto; display: none; border-left: 1px solid var(--line); }
.lb.info-open .lb-info { display: block; }
.lb.info-open .lb-caption { display: none; }
@media (hover: none) { .lb-nav { display: none; } }
@media (max-width: 860px) {
  .lb { flex-direction: column; }
  .lb-info { width: auto; max-height: 58vh; border-left: 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .lb.info-open .lb-main { flex: 1; }
}
.info { padding: 16px; display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.lbl { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-2); }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.save-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--fg-2); transition: opacity .5s ease; }
.save-state .icon { width: 15px; height: 15px; stroke-width: 3; }
.save-state.saved { color: var(--ok); animation: saved-pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.save-state.saved .icon path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: saved-draw .35s .1s ease-out forwards; }
.save-state.gone { opacity: 0; }
.save-state.error { color: var(--danger); }
.save-btn { min-height: 22px; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent); color: var(--accent-fg); border: 0; animation: saved-pop .2s ease-out; }
.spinner { width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes saved-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes saved-draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .save-state, .save-state *, .save-btn { animation: none !important; stroke-dashoffset: 0 !important; } }
.hint { color: var(--fg-2); font-size: 13px; }
.field.provisional input, .field.provisional textarea, .chips.provisional { border-bottom: 2px dotted var(--prov); }
.prov-note { color: var(--prov); font-size: 12px; }
.place-details { margin-top: 6px; }
.place-details summary { cursor: pointer; color: var(--fg-2); font-size: 13px; }
.place-details[open] { display: grid; gap: 10px; }
.chip-input { position: relative; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 8px; min-height: 42px; }
.chips input { flex: 1; min-width: 120px; border: 0; padding: 4px; box-shadow: none !important; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--bg-3); font-size: 14px; }
.chip button { border: 0; background: none; min-height: 0; padding: 0 5px; font-size: 16px; line-height: 1; color: var(--fg-2); }
.info-actions { display: grid; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.dl-group { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-group { display: flex; gap: 4px; }
.tool-group .danger { margin-left: auto; color: var(--danger); }
.banner { margin: 0; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 14%, transparent); }
.history summary { cursor: pointer; color: var(--fg-2); font-size: 13px; }
.history ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 13px; }
.history li small { color: var(--fg-2); }
.history li.reverted { text-decoration: line-through; opacity: .6; }
.history li.provisional { color: var(--prov); }
.meta { color: var(--fg-2); font-size: 12px; margin: 0; }

/* ---------- dialogs & toasts ---------- */
dialog.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(480px, calc(100% - 24px)); background: var(--bg); color: var(--fg); box-shadow: var(--shadow); }
dialog.dlg::backdrop { background: rgba(0,0,0,.45); }
dialog.dlg form { padding: 18px; display: grid; gap: 12px; }
dialog.dlg h2 { margin: 0; font-size: 18px; }
.dlg-body { display: grid; gap: 10px; max-height: 65vh; overflow: auto; }
.dlg-body p { margin: 0; }
.dlg-body progress { width: 100%; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.bulk { display: grid; gap: 12px; }
#toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--bottom-h) + 80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px; background: var(--fg); color: var(--bg); transition: all .2s ease; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* ---------- pages ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 16px 16px 60px; }
.page.wide { max-width: 1200px; }
.page h1 { font-size: 24px; margin: 8px 0 14px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.search-people { max-width: 260px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; margin-bottom: 14px; }
.card h2 { margin: 0; font-size: 16px; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 48px 16px; text-align: center; cursor: pointer; transition: all .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop p { margin: 4px 0; color: var(--fg-2); }
.drop .big { font-size: 20px; color: var(--fg); font-weight: 600; }
.up-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.up-summary p { margin: 0; }
.up-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; font-size: 14px; }
.up-item { display: flex; gap: 10px; padding: 6px 8px; border-radius: 6px; background: var(--bg-2); }
.up-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .status { color: var(--fg-2); text-align: right; }
.up-item.done .status { color: #2a9d55; }
.up-item.error .status { color: var(--danger); white-space: normal; }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 12px; }
.person { display: grid; justify-items: center; gap: 2px; text-align: center; }
.person-link { display: grid; justify-items: center; gap: 4px; color: var(--fg); text-decoration: none; }
.avatar { width: 110px; height: 110px; border-radius: 999px; overflow: hidden; background: var(--bg-3); display: grid; place-items: center; font-size: 40px; color: var(--fg-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person small { color: var(--fg-2); font-size: 12px; }
@media (max-width: 500px) { .people-grid { grid-template-columns: repeat(3, 1fr); } .avatar { width: 88px; height: 88px; } }

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.subtabs a { padding: 8px 12px; color: var(--fg-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.subtabs a.active { color: var(--accent); border-color: var(--accent); }
.table-wrap { overflow-x: auto; }
table.devices { width: 100%; border-collapse: collapse; font-size: 14px; }
table.devices th { text-align: left; font-size: 12px; color: var(--fg-2); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.devices td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.devices tr.blocked { opacity: .55; }
table.devices tr.untrusted td:nth-child(2) { color: var(--prov); }
div.actions { display: flex; flex-wrap: wrap; gap: 4px; }
div.actions button { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: var(--bg-3); font-size: 11px; color: var(--fg-2); }
.edit-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.edit-log li { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; background: var(--bg-2); font-size: 14px; }
.edit-log li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.edit-log img, .edit-log .ph { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; flex: none; display: grid; place-items: center; background: var(--bg-3); }
.edit-log li.reverted { opacity: .55; }
.edit-log li.reverted .new { text-decoration: line-through; }
.edit-log .old { color: var(--fg-2); }
.edit-log li small { color: var(--fg-2); }
.trash { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.trash-item { display: grid; gap: 6px; }
.trash-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.trash-item div { display: flex; gap: 4px; flex-wrap: wrap; }
.trash-item button { padding: 4px 8px; min-height: 30px; font-size: 13px; }

/* ---------- faces ---------- */
.face-row { display: flex; flex-wrap: wrap; gap: 10px; }
.face-chip { display: grid; justify-items: center; gap: 3px; padding: 0; border: 0; background: none; min-height: 0; width: 64px; font-size: 12px; color: var(--fg); }
.face-chip img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid transparent; background: var(--bg-3); }
.face-chip span { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.face-chip.named img { border-color: var(--ok); }
.face-chip.suggested img { border: 2px dashed var(--accent); }
.face-chip.suggested span { color: var(--accent); }
.face-chip.unknown img { border: 2px dashed var(--fg-2); }
.face-chip.unknown span { color: var(--fg-2); }
.lb-faces { position: absolute; inset: 0; pointer-events: none; }
.lb-stage.zoomed .lb-faces { display: none; }
.face-box { position: absolute; pointer-events: auto; padding: 0; min-height: 0; background: transparent; border: 2px solid rgba(255,255,255,.85); border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.face-box.suggested { border-style: dashed; border-color: #9db8ff; }
.face-box.unknown { border-style: dashed; }
.face-box span { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.7); color: #fff; }
.lb-top .icon-btn.on { background: rgba(255,255,255,.25); }
.scan-pill { position: fixed; left: 12px; bottom: calc(var(--bottom-h) + 12px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; }
.face-dialog { display: grid; gap: 12px; justify-items: center; }
.face-dialog .field { width: 100%; }
.face-big { width: 160px; height: 160px; border-radius: 12px; object-fit: cover; background: var(--bg-3); }
.group-dialog { display: grid; gap: 10px; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; max-height: 42vh; overflow: auto; padding: 2px; }
.face-pick { padding: 0; min-height: 0; border: 3px solid var(--accent); border-radius: 10px; overflow: hidden; background: var(--bg-3); aspect-ratio: 1; }
.face-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-pick.off { border-color: transparent; opacity: .35; filter: grayscale(1); }
.faces-sec { display: grid; gap: 10px; margin-bottom: 28px; }
.faces-sec:empty { display: none; }
.sec-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.sec-title h2 { margin: 0; font-size: 18px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.group-card { display: grid; gap: 4px; justify-items: center; padding: 0; min-height: 0; border: 0; background: none; color: var(--fg); text-align: center; }
.group-card small { color: var(--fg-2); }
.mosaic { width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden; display: grid; gap: 2px; background: var(--bg-3); }
.mosaic.n2, .mosaic.n3, .mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic.n2 img { grid-row: span 2; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.group-card:hover, .group-card:focus-visible { background: none; }
.group-card:hover .mosaic, .group-card:focus-visible .mosaic { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
  .group-grid { display: flex; overflow-x: auto; gap: 10px; padding: 4px 2px 6px; scroll-snap-type: x proximity; }
  .group-card { flex: 0 0 92px; scroll-snap-align: start; font-size: 13px; }
}

/* ---------- view-only visitors and share links ---------- */
.signin { flex: none; min-height: 36px; padding: 6px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); border: 0; font-weight: 600; }
.info.read-only .field.ro { display: grid; gap: 2px; }
.ro-val { font-size: 15px; overflow-wrap: anywhere; }
.ro-caption { margin: 0; white-space: pre-wrap; }
.ro-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ro-chips a.chip { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: 14px; }
.ro-chips a.chip:hover { border-color: var(--accent); }
a.face-chip { text-decoration: none; color: inherit; }
.share { display: grid; gap: 10px; min-width: min(460px, 100%); }
.share h3 { margin: 8px 0 0; font-size: 15px; }
.share-make { display: flex; gap: 8px; }
.share-make input { flex: 1; min-width: 0; }
.share-new:not(:empty) { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.share-new p { margin: 0; }
.share-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.share-link { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.share-link .share-url { grid-column: 1 / -1; }
.share-link.off { opacity: .6; }
.share-link .actions { display: flex; gap: 6px; }
@media (max-width: 520px) { .share-make { flex-direction: column; } .share-link { grid-template-columns: 1fr; } }
