:root {
  --bg: #000;
  --bg-1: #0a0a0b;
  --bg-2: #121214;
  --bg-3: #1b1c1f;
  --line: #202225;
  --line-2: #2f3136;
  --text: #dcddde;
  --dim: #8e9297;
  --faint: #5d6167;
  --white: #fff;
  --accent: #fc7d00;
  --accent-hi: #e06f00;
  --on-accent: #000;
  --ok: #43b581;
  --warn: #faa61a;
  --danger: #f04747;

  --tag-general: #c4c9d0;
  --tag-artist: #e8845c;
  --tag-character: #5fbf82;
  --tag-copyright: #c28be0;
  --tag-meta: #d9b35a;

  --rail: 72px;
  --head: 48px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- controls ---------- */

.input, select.input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
}
.input:hover { border-color: var(--line-2); }
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 64px; display: block; }
select.input { width: auto; padding-right: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: #26272b; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--white); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--text); background: var(--bg-2); }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; margin-bottom: 6px;
  color: var(--dim); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
}
.field small, .hint { display: block; margin-top: 5px; color: var(--faint); font-size: 12px; }

.dim { color: var(--dim); }
.error-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }
.spacer { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline > .input { flex: 1; }

.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.check input { accent-color: var(--accent); margin: 0; }

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100%; overflow: hidden; }

.rail {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.rail-groups {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 1; width: 100%; min-height: 0;
  overflow-y: auto; scrollbar-width: none;
}
.rail-groups::-webkit-scrollbar { display: none; }
.rail-sep { flex: none; width: 32px; height: 2px; background: var(--line); border-radius: 1px; }

.rail-item {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  background: var(--bg-2);
  border-radius: 24px;
  color: var(--text);
  font-weight: 600; font-size: 15px;
  overflow: visible;
  transition: border-radius .12s, background-color .12s;
  user-select: none;
}
.rail-item:hover, .rail-item.active { border-radius: 15px; background: var(--accent); color: var(--on-accent); text-decoration: none; }
.rail-item.add { color: var(--ok); }
.rail-item.add:hover, .rail-item.add.active { background: var(--ok); color: var(--white); }
/* Icons are files in /src/icons. They are used as a mask over the text colour, so one file
   follows whatever colour its button currently has (hover, active, accent). */
.icon {
  display: block; width: 22px; height: 22px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.rail-item img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.rail-item::before {
  content: ""; position: absolute; left: -12px; top: 50%;
  width: 4px; height: 0; margin-top: 0;
  background: var(--white); border-radius: 0 4px 4px 0;
  transition: height .12s, margin-top .12s;
}
.rail-item:hover::before { height: 20px; margin-top: -10px; }
.rail-item.active::before { height: 36px; margin-top: -18px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none;
  padding: 6px 10px;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 4px;
  color: var(--white); font-size: 13px; font-weight: 600; white-space: nowrap;
  transform: translateY(-50%);
}

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.head {
  flex: none; display: flex; align-items: center; gap: 12px;
  height: var(--head); padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.head h1 { font-size: 15px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; align-self: stretch; gap: 4px; margin-left: 8px; }
.tab {
  display: flex; align-items: center; padding: 0 10px;
  color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--white); border-bottom-color: var(--accent); }

.body { position: relative; flex: 1; min-height: 0; overflow-y: auto; }
.body.fixed { overflow: hidden; display: flex; flex-direction: column; }

.page { max-width: 620px; padding: 24px 24px 48px; }
.section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.section:first-child { padding-top: 0; }
.section:last-child { border-bottom: 0; }
.section > h2 { margin-bottom: 4px; font-size: 15px; font-weight: 600; color: var(--white); }
.section > p { margin-bottom: 14px; color: var(--dim); }
.actions { display: flex; align-items: center; gap: 10px; }

/* ---------- lists ---------- */

.list { border: 1px solid var(--line); border-radius: 4px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); min-height: 46px; }
.list-row:first-child { border-top: 0; }
.list-row .who { min-width: 0; flex: 1; }
.list-row .who b { display: block; font-weight: 600; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .who span { color: var(--dim); font-size: 12px; overflow-wrap: anywhere; }
.list-empty { padding: 14px 10px; color: var(--faint); }
.role { color: var(--dim); font-size: 12px; text-transform: capitalize; }

.avatar {
  flex: none; display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3); color: var(--text);
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  object-fit: cover; overflow: hidden;
}

/* ---------- gallery ---------- */

.gallery { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.tagside { padding: 14px 12px 24px 16px; border-right: 1px solid var(--line); font-size: 13px; }
.tagside h3 { margin: 14px 0 4px; color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.tagside h3:first-child { margin-top: 0; }
.tagrow { display: flex; align-items: baseline; gap: 6px; line-height: 1.7; }
.tagrow .ops { flex: none; font-family: Consolas, "Liberation Mono", Menlo, monospace; }
.tagrow .ops a { color: var(--faint); padding: 0 1px; }
.tagrow .ops a:hover { color: var(--white); text-decoration: none; }
.tagrow .tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagrow .n { margin-left: auto; color: var(--faint); font-size: 11px; }

.tag { color: var(--tag-general); }
.tag.c-artist { color: var(--tag-artist); }
.tag.c-character { color: var(--tag-character); }
.tag.c-copyright { color: var(--tag-copyright); }
.tag.c-meta { color: var(--tag-meta); }

.gallery-main { padding: 14px 16px 32px; min-width: 0; }
.gallery-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search { display: flex; flex: 1; gap: 8px; min-width: 0; }
.search .ac { flex: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.thumb {
  position: relative; display: block; aspect-ratio: 1;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
}
.thumb:hover { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .badge {
  position: absolute; right: 4px; bottom: 4px; padding: 1px 5px;
  background: rgba(0, 0, 0, .78); border-radius: 2px;
  color: var(--white); font-size: 11px; font-weight: 600;
}
.thumb .place { right: auto; left: 4px; font-weight: 400; color: var(--text); max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-status { padding: 28px 0; color: var(--faint); text-align: center; }
.gallery-more { display: flex; justify-content: center; padding-top: 16px; }

/* ---------- tag autocomplete ---------- */

.ac { position: relative; }
.ac-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .6);
}
.ac-item { display: flex; justify-content: space-between; gap: 12px; padding: 5px 10px; cursor: pointer; }
.ac-item.sel { background: var(--bg-3); }
.ac-item .n { color: var(--faint); font-size: 12px; }

/* ---------- file viewer ---------- */

.viewer { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; background: var(--bg); }
.viewer-body { flex: 1; min-height: 0; display: flex; }
.viewer-media { flex: 1; display: grid; place-items: center; min-height: 0; min-width: 0; padding: 12px; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; }
.viewer-side { flex: none; width: 320px; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--bg-1); }
.viewer-top { flex: none; display: flex; align-items: center; gap: 8px; height: var(--head); padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); }
.viewer-top .who { flex: 1; min-width: 0; line-height: 1.25; }
.viewer-top .who b { display: block; color: var(--white); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-top .who span { color: var(--dim); font-size: 12px; }
.viewer-scroll { flex: 1; overflow-y: auto; padding: 14px; }
.viewer-scroll h3 { margin: 18px 0 6px; color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.viewer-scroll h3:first-child { margin-top: 0; }
.viewer-scroll .tag { display: block; line-height: 1.7; overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; }
.meta dt { color: var(--dim); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.stack > .ac { width: 100%; }
.stack.edit { margin-top: 10px; }
.stack.edit > .stack { width: 100%; }

/* ---------- sheet (upload) ---------- */

.sheet { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; background: var(--bg); }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.sheet-body > * { max-width: 860px; }
.sheet-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--line); }

.drop {
  display: grid; place-items: center; gap: 4px; padding: 28px;
  border: 1px dashed var(--line-2); border-radius: 4px;
  color: var(--dim); text-align: center; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop b { color: var(--white); font-weight: 600; }

.queue { margin: 16px 0; }
.urow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.urow:first-child { border-top: 0; }
.urow .pic { display: grid; place-items: center; width: 56px; height: 56px; background: var(--bg-2); border-radius: 3px; color: var(--faint); font-size: 11px; font-weight: 700; overflow: hidden; }
.urow .pic img { width: 100%; height: 100%; object-fit: cover; }
.urow .name { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.urow .name b { font-weight: 600; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow .name span { flex: none; color: var(--dim); font-size: 12px; }
.urow .state { margin-top: 6px; font-size: 13px; }
.urow .state .btn { margin: 6px 6px 0 0; }
.progress { height: 3px; margin-top: 8px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- chat ---------- */

.chat-log { flex: 1; overflow-y: auto; padding: 12px 16px; }
.msg { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 0 12px; padding: 6px 0; }
.msg .avatar { grid-row: span 3; margin-top: 2px; }
.msg-head b { color: var(--white); font-weight: 600; }
.msg-head time { margin-left: 8px; color: var(--faint); font-size: 11px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-embed { display: block; width: 180px; height: 180px; margin-top: 6px; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: var(--bg-1); }
.msg-embed:hover { border-color: var(--accent); }
.msg-embed img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg .del { position: absolute; right: 0; top: 4px; visibility: hidden; }
.msg:hover .del { visibility: visible; }
.chat-form { flex: none; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.chat-note { flex: none; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--faint); }

/* ---------- admin duplicates ---------- */

.pair { display: flex; align-items: center; gap: 12px; padding: 10px; border-top: 1px solid var(--line); }
.pair:first-child { border-top: 0; }
.pair .side { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.pair img { flex: none; width: 64px; height: 64px; object-fit: cover; border-radius: 3px; background: var(--bg-2); }
.pair .side div { min-width: 0; font-size: 13px; }
.pair .side b { display: block; color: var(--white); font-weight: 600; }
.pair .side span { color: var(--dim); overflow-wrap: anywhere; }

/* ---------- overlays ---------- */

.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { max-width: 360px; padding: 9px 12px; background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: 3px; color: var(--white); }
.toast.bad { border-left-color: var(--danger); }

dialog.ask {
  width: min(400px, calc(100% - 32px)); padding: 20px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 5px; color: var(--text);
}
dialog.ask::backdrop { background: rgba(0, 0, 0, .7); }
dialog.ask p { margin-bottom: 18px; }
dialog.ask .actions { justify-content: flex-end; }

.errorview { display: grid; place-content: center; height: 100%; padding: 24px; max-width: 460px; margin: 0 auto; }
.errorview .code { font-size: 72px; line-height: 1; font-weight: 700; letter-spacing: -2px; color: var(--white); }
.errorview h1 { margin: 12px 0 6px; font-size: 18px; font-weight: 600; color: var(--white); }
.errorview p { color: var(--dim); }

/* ---------- login / invite ---------- */

.auth { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.auth-card { width: min(360px, 100%); }
.auth-card h1 { margin-bottom: 4px; font-size: 20px; font-weight: 600; color: var(--white); }
.auth-card > p { margin-bottom: 22px; color: var(--dim); }
.auth-card .btn { width: 100%; height: 38px; }
.reveal { position: relative; }
.reveal .input { padding-right: 58px; }
.reveal-btn {
  position: absolute; top: 4px; right: 4px; bottom: 4px; padding: 0 8px;
  background: none; border: 0; border-radius: 3px;
  color: var(--dim); font-size: 12px; cursor: pointer;
}
.reveal-btn:hover, .reveal-btn:focus-visible { color: var(--text); background: var(--bg-3); outline: none; }
.auth-card .note { min-height: 20px; margin-top: 12px; font-size: 13px; }

/* ---------- panels ---------- */

.scroll { flex: 1; min-height: 0; overflow-y: auto; }
.page form.inline + .list { margin-top: 14px; }
.avatar.big { width: 64px; height: 64px; font-size: 24px; }
.linkbox { margin-top: 10px; }
.linkbox .input { font-family: Consolas, "Liberation Mono", Menlo, monospace; font-size: 12px; }
.legend { margin: 0; padding: 0; list-style: none; color: var(--dim); }
.legend b { color: var(--text); font-weight: 600; }
.list-row .val { margin-left: auto; color: var(--white); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- batch edit ---------- */

.batch {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 14px; padding: 8px 10px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 3px;
}
.batch b { color: var(--white); font-weight: 600; margin-right: 4px; }
.batch .batch-gap { flex: 1; }
.batch .ac { flex: 1 1 220px; }
.batch .btn { height: 32px; }
.batch .btn.small { height: 26px; }
.batch .input { padding-top: 6px; padding-bottom: 6px; }
.gallery.selecting .thumb { cursor: pointer; }
.gallery.selecting .thumb img { opacity: .55; }
.gallery.selecting .thumb.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.gallery.selecting .thumb.picked img { opacity: 1; }
.gallery.selecting .thumb.picked::after {
  content: "\2713"; position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-size: 13px; font-weight: 700; line-height: 20px; text-align: center;
}
.list-row.sub { border-top: 0; padding-top: 0; padding-left: 52px; }
.list-row .linkbox { margin-top: 0; }
.batch .batch-share { flex-basis: 100%; margin: 6px 0 2px; }
.batch-share .check .dim { font-size: 12px; }
.rail-dot {
  position: absolute; right: -3px; bottom: -3px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--danger); border: 3px solid var(--bg); border-radius: 9px; box-sizing: content-box;
  color: var(--white); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.viewer-top .who { margin-left: 2px; }
.viewer-scroll .filename { font-size: 13px; overflow-wrap: anywhere; }

/* ---------- unread ---------- */

.rail-item.unread:not(.active):not(:hover)::before { height: 8px; margin-top: -4px; }
.tab-count {
  margin-left: 6px; min-width: 16px; height: 16px; padding: 0 5px; border-radius: 8px;
  background: var(--danger); color: var(--white);
  font-size: 11px; font-weight: 700; line-height: 16px; text-align: center;
}

/* ---------- name colours ---------- */

/* Two classes plus an element beat the plain "names are white" rules wherever a name sits. */
body:not(.plain-names) .uname, body .uname.always { color: var(--name); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  background: var(--swatch, var(--bg-3)); border: 0; border-radius: 50%;
  color: var(--dim); cursor: pointer;
}
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--white); }
.swatch.custom:not(.on) { border: 1px dashed var(--line-2); }
.swatch.custom:not(.on):hover { color: var(--text); }
.swatch .icon { width: 16px; height: 16px; }
.swatch-input { position: absolute; width: 0; height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.check.lone { margin-top: 14px; }
.upload-total { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress.upload-bar { flex: none; height: 4px; margin: 0; border-radius: 0; }
.progress.upload-bar i { transition: width .3s linear; }
.progress.upload-bar.done i { background: var(--ok); }

/* ---------- storage meter ---------- */

.meter-block { margin-bottom: 14px; }
.meter-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.meter-label b { color: var(--white); font-weight: 600; }
.meter-label span { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.meter { --meter: var(--accent); height: 8px; border-radius: 4px; overflow: hidden; background: color-mix(in srgb, var(--meter) 20%, transparent); }
.meter.warn { --meter: var(--warn); }
.meter.danger { --meter: var(--danger); }
.meter i { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--meter); transition: width .6s ease-out; }
@media (prefers-reduced-motion: reduce) { .meter i { transition: none; } }

/* ---------- phones: gallery and file viewer ---------- */

/* Only the gallery and the viewer that opens from it change here. Search and the buttons stay
   on top, three thumbnails per row, and the tag list moves from the side to below the grid. */
@media (max-width: 700px) {
  .gallery { display: flex; flex-direction: column; }
  .gallery-main { order: 1; padding: 10px 10px 20px; }
  .tagside { order: 2; padding: 14px 12px 28px; border-right: 0; border-top: 1px solid var(--line); }

  .gallery-bar { flex-wrap: wrap; }
  .gallery-bar .search { flex: 1 1 100%; }
  .gallery-bar > .btn, .gallery-bar > select.input { flex: 1; }
  .gallery .input { font-size: 16px; } /* smaller text makes iOS zoom the page on focus */

  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .thumb .badge { font-size: 10px; padding: 0 4px; }

  .batch { padding: 8px; }
  .batch .batch-gap { display: none; }
  .batch select.input { flex: 1 1 100%; width: 100%; }

  /* Viewer: the file on top, details underneath when opened. */
  .viewer-top { gap: 6px; padding: 0 8px; }
  .viewer-top .avatar { display: none; }
  .viewer-top .who span { display: none; }
  .viewer-body { flex-direction: column; }
  .viewer-media { padding: 6px; }
  .viewer-side { width: auto; max-height: 55%; border-left: 0; border-top: 1px solid var(--line); }
}
.list-row.off .avatar, .list-row.off .who { opacity: .45; }
.auth-card #invited { color: var(--accent); font-weight: 700; }

/* ---------- tag suggestions ---------- */

.stack.suggest { width: 100%; }
.stack.suggest > * { width: 100%; }
.stack.suggest > .btn { width: auto; }
.list-row.suggestion { align-items: flex-start; padding: 12px 10px; }
.suggestion .pic { flex: none; width: 72px; height: 72px; border-radius: 3px; overflow: hidden; background: var(--bg-2); }
.suggestion .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.suggestion .who > div:first-child span { display: inline; }
.suggestion .note { margin-top: 4px; color: var(--text); overflow-wrap: anywhere; }
.suggestion .picks { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; margin-top: 8px; }
.suggestion .picks small { flex: none; width: 56px; color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.suggestion .check { padding: 2px 0; }
.suggestion .check.moot { opacity: .55; cursor: default; }
.suggestion .check .dim { font-size: 12px; }
.suggestion .actions { margin-top: 10px; }
.gallery-tally { margin: -6px 0 10px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
code { font: 12px Consolas, "Liberation Mono", Menlo, monospace; color: var(--text); background: var(--bg-2); padding: 1px 5px; border-radius: 3px; }
