/* ImageHost UI: monochrome hairlines with an accent colour layer at the end. Radius 6px (8px for cards). */

@font-face { font-family: "Inter"; src: url("/imagehost/assets/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --accent: #4f46e5;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --surface-3: #ebebeb;
  --line: #e8e8e8;
  --line-2: #d9d9d9;
  --text: #0a0a0a;
  --text-2: #404040;
  --muted: #737373;
  --faint: #a3a3a3;
  --invert: #ffffff;
  --red: #e5484d;
  --green: #12a150;
  --amber: #c98a0b;
  --shadow: 0 8px 30px -6px rgba(0, 0, 0, .14), 0 0 0 1px var(--line);
  --r: 6px;
  --font: "Inter", ui-sans-serif, -apple-system, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --wrap: 1200px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --surface: #111111; --surface-2: #171717; --surface-3: #222222;
    --line: #232323; --line-2: #333333; --text: #ededed; --text-2: #c7c7c7; --muted: #8f8f8f; --faint: #5e5e5e; --invert: #0a0a0a;
    --shadow: 0 8px 30px -6px rgba(0, 0, 0, .6), 0 0 0 1px var(--line); --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --surface: #111111; --surface-2: #171717; --surface-3: #222222;
  --line: #232323; --line-2: #333333; --text: #ededed; --text-2: #c7c7c7; --muted: #8f8f8f; --faint: #5e5e5e; --invert: #0a0a0a;
  --shadow: 0 8px 30px -6px rgba(0, 0, 0, .6), 0 0 0 1px var(--line); --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip;
  font: 14px/1.6 var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01", "ss03";
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
p a, .prose a, .link, .field-link, .auth-foot a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
p a:hover, .prose a:hover, .link:hover, .field-link:hover, .auth-foot a:hover { text-decoration-color: var(--text); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; }
h1 { font-size: 1.75rem; letter-spacing: -.035em; }
h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
h3 { font-size: .95rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
small { font-size: .85em; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.icon { flex: none; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.grow { flex: 1; }
.top-gap { margin-top: 14px; }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-end { display: flex; justify-content: flex-end; margin-top: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; padding: 8px 12px; border-radius: var(--r); background: var(--surface); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.page { flex: 1; padding-top: 40px; padding-bottom: 80px; }
.eyebrow { display: block; margin-bottom: 6px; font: 500 .72rem var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kbd { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-2); border-bottom-width: 2px; font: 500 .72rem var(--mono); color: var(--text-2); }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: .95rem; letter-spacing: -.02em; color: var(--text) !important; }
.brand-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--text); color: var(--invert); }
.brand-mark .icon { width: 14px; height: 14px; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { position: relative; color: var(--muted); font-weight: 500; font-size: .86rem; transition: color .15s; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav a .icon { display: none; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: color .15s, background .15s, border-color .15s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn.copied { color: var(--green); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.nav-toggle { display: none; }
.menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 2px; border: 0; border-radius: 999px; background: none; color: var(--text); font: 500 .86rem var(--font); cursor: pointer; }
.user-btn .user-name { padding-right: 4px; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--invert); font-size: .72rem; font-weight: 600; }
.avatar.lg { width: 40px; height: 40px; font-size: .95rem; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.5rem; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px; padding: 4px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); opacity: 0; transform: translateY(-4px); pointer-events: none; transition: .14s; }
.menu.open .menu-pop { opacity: 1; transform: none; pointer-events: auto; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 4px; background: none; color: var(--text-2); font: 400 .86rem var(--font); text-align: left; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); color: var(--text); }
.menu-pop .icon { width: 15px; height: 15px; color: var(--muted); }
.menu-pop form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head b { display: block; font-weight: 600; }
.menu-head small { color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 .86rem var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; }
.btn:hover { color: var(--text); background: var(--surface-2); }
.btn:active { opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 15px; height: 15px; }
.btn.primary { border-color: var(--text); background: var(--text); color: var(--invert); }
.btn.primary:hover { color: var(--invert); opacity: .86; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { border-color: var(--red); background: var(--red); color: #fff; }
.btn.danger:hover { color: #fff; opacity: .88; }
.btn.sm { height: 30px; padding: 0 11px; font-size: .82rem; }
.btn.lg { height: 40px; padding: 0 18px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font: 400 .84rem var(--font); cursor: pointer; }
.btn-link:hover { color: var(--text); }
.btn-link.danger:hover { color: var(--red); }
.btn-link .icon { width: 14px; height: 14px; }

/* ---------- fields ---------- */
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=tel], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font: 400 .88rem var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 9px 11px; line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { padding-right: 30px; appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent); }
/* File pickers: a dashed drop-style field with a real button inside. */
input[type=file] { width: 100%; padding: 6px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface-2); color: var(--muted); font: .84rem var(--font); cursor: pointer; transition: border-color .15s, background .15s; }
input[type=file]:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); background: var(--accent-soft); }
input[type=file]:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file]::file-selector-button { height: 30px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface); color: var(--text); font: 500 .82rem var(--font); cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: border-color .15s, background .15s; }
input[type=file]::file-selector-button:hover { border-color: var(--accent); color: var(--accent-ink); }
input[type=color] { width: 40px; height: 34px; padding: 2px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; accent-color: var(--text); }
.field { display: block; margin-bottom: 16px; }
.field > span:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; font-weight: 500; font-size: .82rem; color: var(--text-2); }
.field > span small { font-weight: 400; color: var(--muted); }
.field-link { margin-left: auto; font-weight: 400; font-size: .8rem; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: .86rem; color: var(--text-2); cursor: pointer; }
.form { margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.color-row { display: flex; align-items: center; gap: 10px; }

.switch { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch input[type=checkbox] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch .track { position: relative; flex: none; width: 32px; height: 18px; margin-top: 2px; border-radius: 999px; background: var(--line-2); transition: background .18s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .18s; }
.switch input:checked + .track { background: var(--text); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--invert); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { display: flex; flex-direction: column; }
.switch-text b { font-weight: 500; font-size: .88rem; }
.switch-text small { color: var(--muted); }
/* A button right after a switch row gets breathing room below its divider line. */
.switch + .btn, .switch + button { margin-top: 18px; }
.switch + .field, .switch + .two, .switch + .three { margin-top: 16px; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin-bottom: 16px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.pad { padding: 24px; }
.narrow { max-width: 640px; margin: 0 auto; }
.narrow-left { max-width: 720px; }
.section { margin-top: 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: .9rem; font-weight: 600; }
.section-head .eyebrow { display: none; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); }
.link-more:hover { color: var(--text); }
.link-more .icon { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; }
.crumb { color: var(--muted); font-weight: 400; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--muted); font: 500 .7rem var(--mono); text-transform: lowercase; white-space: nowrap; }
.badge .icon { width: 11px; height: 11px; }
.badge.accent { border-color: var(--text); color: var(--text); }
.badge.red { border-color: color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }

.flashes { display: grid; gap: 8px; margin-bottom: 24px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); font-size: .86rem; }
.flash::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.flashes .flash { margin: 0; }
/* On sign in, sign up and password pages, messages line up with the form box. */
.page:has(> .auth-split, > .auth.solo) > .flashes { max-width: 400px; margin-left: auto; margin-right: auto; }
.flash span { flex: 1; }
.flash.success::before { background: var(--green); }
.flash.error { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.flash.error::before { background: var(--red); }
.flash.info::before { background: var(--accent); }
.flash-x { padding: 2px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.flash-x:hover { color: var(--text); }

.empty { padding: 72px 20px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--muted); text-align: center; }
.empty .icon { margin: 0 auto 14px; width: 28px; height: 28px; opacity: .5; }
.empty h2 { justify-content: center; margin-bottom: 6px; color: var(--text); font-size: .95rem; }
.empty p { margin-bottom: 18px; }
.empty.big { border: 0; padding: 110px 20px; }
.empty-code { margin-bottom: 10px; font: 500 4.5rem/1 var(--mono); letter-spacing: -.06em; color: var(--faint); }

/* Underline tabs, used for page filters, uploader modes, link formats and settings. */
.seg, .tabs { display: flex; flex-wrap: wrap; gap: 20px; border-bottom: 1px solid var(--line); }
.seg a, .seg button, .tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; margin-bottom: -1px; padding: 8px 0; border: 0; border-bottom: 1px solid transparent;
  background: none; color: var(--muted); font: 500 .84rem var(--font); white-space: nowrap; cursor: pointer; transition: color .15s;
}
.seg a:hover, .seg button:hover, .tab:hover { color: var(--text); }
.seg a.on, .seg button.on, .tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .icon { display: none; }
.tabs.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.page-head .seg { border-bottom: 0; }
.seg-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.seg-radio label { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; transition: border-color .15s; }
.seg-radio label:has(input:checked) { border-color: var(--text); }
.seg-radio input { margin-top: 3px; }
.seg-radio span { display: flex; flex-direction: column; }
.seg-radio small { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r); border: 1px solid var(--line-2); color: var(--text-2); font-size: .82rem; }
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip small { color: var(--muted); font-family: var(--mono); }
.chip .icon { width: 13px; height: 13px; color: var(--muted); }
.chip.on { border-color: var(--text); background: var(--text); color: var(--invert); }
.chip.on small, .chip.on .icon { color: var(--invert); opacity: .7; }
.chip.small { padding: 2px 7px; font: .72rem var(--mono); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.search { display: flex; gap: 8px; }
.search input[type=search] { width: 240px; padding-left: 32px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 11px center; }
.search select { width: auto; }

/* ---------- home ---------- */
.home { position: relative; max-width: 760px; margin: 0 auto; }

/* Homepage background: a faint dot grid that drifts slowly (background-position only). */
.home-bg { position: absolute; z-index: -1; top: -40px; left: 50%; width: 100vw; height: 780px; overflow: hidden; transform: translateX(-50%); pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.bg-grid { position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 1.3px); background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000, transparent 75%);
  animation: bg-grid-pan 40s linear infinite; }
@keyframes bg-grid-pan { to { background-position: 24px 48px; } }
.hero { padding: 24px 0 0; text-align: center; }
.hero h1 { margin: 0 0 12px; font-size: clamp(2rem, 4.4vw, 2.9rem); font-weight: 600; letter-spacing: -.045em; line-height: 1.08; }
.hero h1 em { font-style: normal; color: var(--faint); }
.lead { max-width: 520px; margin: 0 auto 36px; color: var(--muted); font-size: .98rem; }
.hero-badge, .features, .stats-strip, .feature { display: none; }
.home .section { margin-top: 72px; }
.home .jtile { --h: 160px; }

/* ---------- uploader ---------- */
.uploader, .results { text-align: left; }
/* The upload form sits in a card, like the sign-in box. */
.uploader { position: relative; padding: 0 20px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -18px rgba(0, 0, 0, .18); }
.up-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 -20px 18px; padding: 6px 20px 0; border-bottom: 1px solid var(--line); }
.up-head .tabs { border-bottom: 0; }
.up-limits { padding-bottom: 9px; font: .72rem var(--mono); color: var(--muted); }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 240px; padding: 32px 24px; border: 1px dashed var(--line-2); border-radius: 6px; background: var(--surface-2);
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--faint); }
.dropzone.over { border-color: var(--text); background: var(--surface-3); }
.dropzone input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.dz-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); transition: transform .2s; }
.dz-icon .icon { width: 17px; height: 17px; }
.dropzone:hover .dz-icon, .dropzone.over .dz-icon { transform: translateY(-2px); }
.dz-title { font-size: .95rem; font-weight: 500; }
.dz-title u { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.dz-sub { color: var(--muted); font-size: .84rem; }
.dz-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 18px; font-size: .76rem; color: var(--muted); }
.dz-keys .kbd { margin-right: 4px; }
/* URL and web page tabs sit flat in the uploader card, no second box. */
.panel-pad { min-height: 160px; }
.up-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.opt { display: flex; align-items: center; flex: 1; min-width: 150px; }
.opt > span { display: none; }
.opt-go { flex: 0 0 auto; min-width: 0; }
.opt select, .opt-go .btn { height: 36px; }
.opt-go .btn { padding: 0 18px; font-size: .86rem; }
.uploader .fine { margin: 16px -20px -18px; padding: 12px 20px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; background: var(--surface-2); }
.fine { margin: 12px 0 0; font-size: .76rem; color: var(--muted); }
.fine a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }

.scan-results { margin-top: 14px; }
.scan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: .84rem; }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 340px; overflow: auto; }
.scan-item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.scan-item img { width: 100%; height: 100%; object-fit: cover; }
.scan-item input { position: absolute; top: 6px; left: 6px; z-index: 1; }
.scan-item:has(input:checked) { outline: 2px solid var(--text); outline-offset: -2px; }

/* Queue: thumbnails with a thin progress ring. */
.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; max-height: 480px; overflow: auto; padding: 2px; }
.q-item { position: relative; min-width: 0; animation: fade .2s ease; }
.q-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; transition: filter .2s; }
.q-item.uploading .q-thumb img, .q-item.queued .q-thumb img { filter: grayscale(.4) brightness(.6); }
.q-ring { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; }
.q-item.uploading .q-ring { display: grid; }
.q-ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.q-ring circle { fill: none; stroke-width: 2.5; }
.q-ring .bg { stroke: rgba(255, 255, 255, .25); }
.q-ring .fg { stroke: #fff; stroke-linecap: round; stroke-dasharray: 138.2; stroke-dashoffset: 138.2; transition: stroke-dashoffset .25s; }
.q-pct { position: absolute; font: 500 .66rem var(--mono); color: #fff; }
.q-state { position: absolute; top: 6px; left: 6px; display: none; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; }
.q-state svg { width: 11px; height: 11px; }
.q-item.done .q-state { display: grid; background: var(--green); }
.q-item.error .q-state { display: grid; background: var(--red); font-size: 11px; }
.q-item.error .q-thumb img { filter: grayscale(1) opacity(.5); }
.q-main { padding: 6px 1px 0; min-width: 0; }
.q-name { overflow: hidden; font-size: .78rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.q-meta { overflow: hidden; font: .7rem var(--mono); color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.q-item.error .q-meta { color: var(--red); white-space: normal; }
.q-item.done .q-meta { color: var(--green); }
.q-item > .icon-btn { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; opacity: 0; }
.q-item:hover > .icon-btn, .q-item > .icon-btn:focus-visible { opacity: 1; }
.q-add { position: relative; display: grid; place-items: center; align-content: center; gap: 4px; aspect-ratio: 1; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); font-size: .76rem; cursor: pointer; }
.q-add:hover { border-color: var(--text); color: var(--text); }
.q-add svg { width: 16px; height: 16px; }
.progress { height: 2px; overflow: hidden; border-radius: 999px; background: var(--line); }
.progress span { display: block; width: 0; height: 100%; background: var(--text); transition: width .25s; }

/* Results */
.results { margin-top: 40px; scroll-margin-top: 80px; }
.results-card { padding: 0; border: 0; background: none; }
.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.results-head h2 { margin: 0; font-size: .95rem; }
.results-head h2 .icon { width: 16px; height: 16px; color: var(--green); }
.results-tools { display: flex; gap: 6px; }
.fmt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.fmt-bar .seg { border-bottom: 0; }
.fmt-size { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--muted); cursor: pointer; }
.fmt-bar .btn { margin-left: auto; }
.result-list { display: grid; }
.rrow { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); animation: fade .25s ease; }
.rrow-thumb { display: block; width: 48px; height: 48px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.rrow-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rrow-main { min-width: 0; }
.rrow-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.rrow-title b { overflow: hidden; font-size: .86rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.rrow-title span { flex: none; font: .7rem var(--mono); color: var(--muted); }
input.rrow-code { width: 100%; height: 30px; font: .76rem var(--mono); color: var(--text-2); background: var(--surface-2); border-color: transparent; }
.rrow-actions { display: flex; gap: 2px; }
.del-link { margin-top: 4px; overflow: hidden; font: .7rem var(--mono); color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.del-link a { color: var(--red); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.notice { display: flex; align-items: center; gap: 18px; max-width: 640px; margin: 0 auto; padding: 24px; }
.notice h2 { margin: 0 0 12px; font-size: .95rem; }
.notice p { margin: 0; }
.notice-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--r); border: 1px solid var(--line-2); color: var(--muted); }

/* ---------- justified gallery ---------- */
/* Image grid: five equal square cards per row, each boxed with a caption strip. */
.jgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.jtile { position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: border-color .15s, box-shadow .15s; }
.jtile:hover { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 24px -16px rgba(0, 0, 0, .25); }
.jtile > a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); }
.jtile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.jtile:hover img { transform: scale(1.03); }
.jtile.small img { position: absolute; inset: 0; width: auto; height: auto; max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; transform: none; }
.jtile figcaption { padding: 9px 12px 10px; border-top: 1px solid var(--line); }
.jtile .tile-meta { display: block; overflow: hidden; color: var(--muted); opacity: 1; white-space: nowrap; text-overflow: ellipsis; }
.tile-title { display: block; overflow: hidden; font-size: .8rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.tile-meta { display: flex; align-items: center; gap: 5px; font: .66rem var(--mono); opacity: .8; }
.tile-meta .icon { width: 11px; height: 11px; }
.tile-badges { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; pointer-events: none; }
.tile-badge { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; font: 600 .62rem var(--mono); }
.tile-badge .icon { width: 11px; height: 11px; }
.tile-copy { position: absolute; top: 6px; left: 6px; z-index: 2; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s; }
.tile-copy .icon { width: 13px; height: 13px; }
.jtile:hover .tile-copy, .tile-copy:focus-visible { opacity: 1; }
.selectable .tile-copy { display: none; }
.tile-check { position: absolute; top: 6px; left: 6px; z-index: 2; cursor: pointer; }
.tile-check input { position: absolute; opacity: 0; }
.tile-check span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; border: 1.5px solid rgba(255, 255, 255, .9); background: rgba(0, 0, 0, .25); transition: .15s; }
.tile-check input:checked + span { border-color: #fff; background: #fff; }
.tile-check input:checked + span::after { content: ""; width: 9px; height: 5px; border: 2px solid #000; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.tile-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.selectable .jtile .tile-check span { opacity: 0; }
.selectable .jtile:hover .tile-check span, .selectable.has-selection .tile-check span, .tile-check input:checked + span, .tile-check input:focus-visible + span { opacity: 1; }
.jtile:has(input:checked) { outline: 2px solid var(--text); outline-offset: 2px; }
.jtile:has(input:checked) img { opacity: .8; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-top: 40px; }
.pager a, .pager span { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 10px; border-radius: var(--r); font: .8rem var(--mono); color: var(--muted); }
.pager a:hover { background: var(--surface-2); color: var(--text); }
.pager .cur { background: var(--text); color: var(--invert); }
.pager .off { color: var(--faint); }

.bulk-bar { position: sticky; bottom: 20px; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: fit-content; max-width: 100%; margin: 20px auto 0; padding: 6px 6px 6px 14px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); animation: fade .15s ease; }
.bulk-bar > span { margin-right: 8px; font-size: .84rem; color: var(--muted); }
.bulk-bar > span b { color: var(--text); font-weight: 600; }
.bulk-bar select { width: auto; height: 30px; font-size: .82rem; }

/* ---------- viewer ---------- */
.viewer { display: grid; gap: 32px; }
/* Fixed-size frame: the same height for every image; the picture scales to fit inside. */
/* The preview sits in a card, like the sign-in and upload boxes. */
.v-box { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -18px rgba(0, 0, 0, .18); }
.v-stage { position: relative; height: clamp(320px, 64vh, 700px); margin: 12px 12px 0; padding: 24px; overflow: hidden; border-radius: 6px; background: none; }
.v-box-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin-top: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font: .72rem var(--mono); color: var(--muted); }
.stage-img { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.stage-img img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.no-zoom .stage-img img { cursor: default; }
.no-zoom [data-zoom-btn], .no-zoom [data-zoom-hint] { display: none; }
.v-stage.zoomed { overflow: auto; }
.v-stage.zoomed .stage-img { display: block; width: max-content; height: auto; min-width: 100%; }
.v-stage.zoomed .stage-img img { max-width: none; max-height: none; margin: 0 auto; cursor: zoom-out; }
.v-tools { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; gap: 2px; padding: 2px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); opacity: 0; transition: opacity .15s; }
.v-stage:hover .v-tools, .v-tools:focus-within { opacity: 1; }
.v-tools a, .v-tools button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }
.v-tools a:hover, .v-tools button:hover { background: var(--surface-2); color: var(--text); }
.v-tools .icon { width: 15px; height: 15px; }
.stage-nav { position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 34px; height: 34px; margin-top: -17px; border-radius: var(--r); background: var(--surface); color: var(--text) !important; box-shadow: var(--shadow); opacity: 0; transition: opacity .15s; }
.v-stage:hover .stage-nav, .stage-nav:focus-visible { opacity: 1; }
.stage-nav.prev { left: 12px; }
.stage-nav.next { right: 12px; }
.v-info { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.v-info > section { padding: 26px 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.v-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.v-title h1 { margin: 0 0 8px; font-size: 1.45rem; letter-spacing: -.03em; word-break: break-word; }
.v-by { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 24px; color: var(--muted); font-size: .84rem; }
.v-by .avatar { width: 20px; height: 20px; font-size: .62rem; }
.v-by a { color: var(--text); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; margin: 0 0 24px; border-top: 1px solid var(--line); }
.facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font: .68rem var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-size: .9rem; font-weight: 500; }
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.stars { display: flex; gap: 1px; }
.star { padding: 1px; border: 0; background: none; color: var(--line-2); cursor: pointer; transition: color .1s; }
.star .icon { width: 17px; height: 17px; fill: currentColor; }
.star.on, .star.hover { color: var(--text); }
.star:disabled { cursor: default; }
.rating-text { font: .74rem var(--mono); color: var(--muted); }
.side-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.side-actions.minor { gap: 22px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.side-actions.minor form { display: flex; margin: 0; }
.sharebox { padding: 0; border: 0; background: none; }
.sharebox h2 { margin-bottom: 8px; font-size: .95rem; }
.sharebox h2 .icon { display: none; }
.share-fmt { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.share-fmt .seg { border-bottom: 0; }
.share-field { display: flex; flex-direction: column; gap: 12px; }
.share-field textarea { min-height: 92px; padding: 12px 14px; font: .78rem/1.55 var(--mono); color: var(--text-2); background: var(--surface-2); border-color: transparent; resize: none; word-break: break-all; }
.share-field .btn { align-self: flex-start; }
.share-note { margin: 12px 0 0; font-size: .8rem; color: var(--muted); }
.h-small { font-size: .9rem; }
.codes { display: grid; gap: 10px; }
.code { display: block; }
.code > span:first-child { display: block; margin-bottom: 4px; font-size: .74rem; color: var(--muted); }
.code input { height: 32px; }
.code-row { display: flex; align-items: stretch; gap: 6px; }
.code-row input, .code-row textarea { font: .78rem var(--mono); background: var(--surface-2); border-color: transparent; }
.code-row .icon-btn { width: 36px; height: auto; min-height: 34px; border: 1px solid var(--line-2); }
.delete-preview { margin: 20px 0; }
.delete-preview img { max-height: 260px; margin: 0 auto; border-radius: var(--r); }

/* ---------- members and profiles ---------- */
/* Members: boxed cards in the same five-column grid as the image gallery. */
.member-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.member { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: border-color .15s, box-shadow .15s; }
.member:hover { color: var(--text); border-color: var(--line-2); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 24px -16px rgba(0, 0, 0, .25); }
.member-body { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 4px; padding: 24px 14px 20px; text-align: center; }
.member-body .avatar { margin-bottom: 8px; }
.member-name { max-width: 100%; overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.member-body small { font: .7rem var(--mono); color: var(--muted); }
.member-badge { position: absolute; top: 10px; right: 10px; }
.list-note { margin: 24px 0 0; font: .72rem var(--mono); color: var(--faint); text-align: center; }
.member-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px 10px; border-top: 1px solid var(--line); background: var(--surface-2);
  font: .7rem var(--mono); color: var(--muted); }
.member-foot span:last-child { transition: transform .15s, color .15s; }
.member:hover .member-foot span:last-child { color: var(--text); transform: translateX(3px); }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 0 0 24px; margin-bottom: 24px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.profile-info { flex: 1; min-width: 200px; }
.profile-info h1 { margin: 0 0 2px; font-size: 1.5rem; }
.profile-info p { margin: 0; font-size: .84rem; }
.profile-actions { display: flex; gap: 6px; }

/* ---------- my images ---------- */
.my-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; align-items: start; }
.album-list { position: sticky; top: 80px; padding: 0; border: 0; background: none; }
.album-list-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 8px 8px; }
.album-list-head b { font: .7rem var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.album-link { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r); color: var(--muted); font-size: .86rem; }
.album-link .icon { width: 14px; height: 14px; }
.album-link small { margin-left: auto; font: .72rem var(--mono); color: var(--faint); }
.album-link:hover { color: var(--text); background: var(--surface-2); }
.album-link.on { color: var(--text); background: var(--surface-2); font-weight: 500; }
.album-tools { margin-top: 10px; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.select-all { margin: 0; }

/* ---------- dialogs and toasts ---------- */
.dialog { width: min(460px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog[open] { animation: fade .15s ease; }
.dialog h2 { margin-bottom: 14px; font-size: 1rem; }
.dialog p { color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toasts { position: fixed; bottom: 20px; left: 50%; z-index: 100; display: grid; gap: 6px; justify-items: center; transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r); background: var(--text); color: var(--invert); font-size: .84rem; box-shadow: var(--shadow); animation: fade .2s ease; }
.toast::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.toast.error::before { background: var(--red); }

/* ---------- auth ---------- */
.auth-split { display: block; max-width: 400px; margin: 32px auto; }
.auth-art { display: none; }
.auth, .auth.solo { max-width: 400px; margin: 32px auto; padding: 32px 32px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -18px rgba(0, 0, 0, .18); }
.auth-split .auth { margin: 0; }
.auth > .form, .auth > form { padding-bottom: 28px; }
.auth-mark { width: 30px; height: 30px; margin-bottom: 18px; border-radius: 7px; }
.auth-mark .icon { width: 16px; height: 16px; }
.auth-head { margin-bottom: 24px; }
.auth-head h1 { margin-bottom: 6px; font-size: 1.35rem; }
.auth-head p { margin: 0; font-size: .86rem; }
.auth-foot { margin: 0 -32px; padding: 16px 32px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: .84rem; text-align: center; }

/* ---------- stats, settings, tools ---------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stats-row.four { grid-template-columns: repeat(4, 1fr); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--surface); }
.stat:last-child { border-right: 0; }
.stat > span { display: none; }
.stat b { font-size: 1.45rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
.stat small { font-size: .76rem; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings-grid h2, .tool-grid .card h2 { margin-bottom: 14px; }
.settings-grid h2 .icon, .tool-grid .card h2 .icon { width: 15px; height: 15px; color: var(--muted); }
.danger-zone { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.page-head-note { max-width: 360px; font-size: .88rem; text-align: right; }

/* Tools: boxed cards with an icon header, a code panel and an action strip. */
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tool { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: border-color .15s, box-shadow .15s; }
.tool:hover { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 28px -18px rgba(0, 0, 0, .25); }
.tool-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.tool-ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.tool-ico .icon { width: 18px; height: 18px; }
.tool-kicker { display: block; margin-bottom: 2px; font: 500 .66rem var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.tool-head h2 { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.tool-body { display: flex; flex: 1; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.tool-body p { margin: 0; }
.tool-body .muted { font-size: .88rem; line-height: 1.6; }
.code-block { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--line); font: 500 .66rem var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.code-copy { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--muted); font: 500 .74rem var(--font); cursor: pointer; transition: color .15s, background .15s, border-color .15s; }
.code-copy:hover { border-color: var(--line-2); background: var(--surface); color: var(--text); }
.code-copy.copied { color: var(--green); }
.code-block textarea { display: block; width: 100%; padding: 12px; border: 0; border-radius: 0; background: none; font: .76rem/1.6 var(--mono); color: var(--text-2); resize: none; box-shadow: none; }
.code-block textarea:focus { outline: none; box-shadow: none; }
.tool-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.tool-steps li { position: relative; padding-left: 32px; font-size: .86rem; line-height: 22px; color: var(--text-2); counter-increment: step; }
.tool-steps li::before { content: counter(step); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line-2); border-radius: 50%; font: 500 .7rem var(--mono); color: var(--muted); }
.tool-steps b { font-weight: 500; color: var(--text); }
.tool-foot { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 20px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: .84rem; }
.tool-foot > a { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--text); }
.tool-foot > a .icon { width: 15px; height: 15px; }
.tool-foot > a span { transition: transform .15s; }
.tool-foot > a:hover span { transform: translateX(3px); }
.tool-preview { justify-content: space-between; }
.tool-preview > span { font: 500 .66rem var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.prose { font-size: .95rem; line-height: 1.7; }
.prose.card { padding: 0; border: 0; background: none; }
.prose h1 { margin-bottom: 24px; }
.prose h3 { margin-top: 1.8em; font-size: .95rem; }
.prose p, .prose li { color: var(--text-2); }
.prose h2 { margin: 1.6em 0 .5em; font-size: 1.15rem; }
.prose h4 { margin: 1.4em 0 .4em; font-size: .9rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose blockquote { margin: 1.2em 0; padding: .1em 0 .1em 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose pre { padding: 12px 14px; overflow: auto; border-radius: 6px; background: var(--surface-2); font: .82rem/1.6 var(--mono); }
.prose hr { margin: 1.8em 0; border: 0; border-top: 1px solid var(--line); }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

/* ---------- admin ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin-bottom: 16px; border: 0; background: none; }
.filters input, .filters select { flex: 1; width: auto; min-width: 140px; height: 32px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.table th { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font: 500 .68rem var(--mono); letter-spacing: .03em; text-align: left; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.table th a:hover { color: var(--text); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:has(input[data-select]:checked) { background: var(--surface-2); }
.table a { font-weight: 500; }
.w-check { width: 36px; }
.file-cell { display: flex; align-items: center; gap: 12px; }
.file-thumb { flex: none; width: 40px; height: 40px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.chart-card { margin-bottom: 28px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.chart-head h2 { margin: 0; font-size: .9rem; }
.legend { display: flex; align-items: center; gap: 8px; font: .72rem var(--mono); color: var(--muted); }
.legend b { margin-right: 12px; font-weight: 500; color: var(--text); }
.lg-up, .lg-views { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--text); }
.lg-views { height: 2px; background: var(--muted); }
.chart { width: 100%; height: 180px; overflow: visible; }
.up-bar { fill: var(--text); opacity: .85; }
.up-bar:hover { opacity: 1; }
.views-line { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; stroke-linejoin: round; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; font: .68rem var(--mono); color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.dash-grid .section-head { padding-bottom: 10px; margin-bottom: 14px; }
.dash-grid .section-head h2 { font-size: .86rem; }
.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.mini-grid a, .mini-grid .gone { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.mini-grid img { width: 100%; height: 100%; object-fit: cover; }
.mini-grid .gone { display: grid; place-items: center; font: .66rem var(--mono); color: var(--muted); text-align: center; }
.plain-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.plain-list li { display: flex; flex-direction: column; font-size: .86rem; }
.ban-list { display: grid; margin: 0; padding: 0; list-style: none; }
.ban-list li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ban-list .check { margin: 0; }
.bot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px; margin: 14px 0 0; padding: 0; list-style: none; }
.bot-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 10px; border-radius: var(--r); background: var(--surface-2); font-size: .82rem; }
.bot-list form { margin: 0; }
.top-bots { margin-bottom: 18px; }
.messages { display: grid; border-top: 1px solid var(--line); }
.message { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.message summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 4px; list-style: none; cursor: pointer; }
.message summary::-webkit-details-marker { display: none; }
.message.unread .msg-subject { font-weight: 600; }
.message.unread summary::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.msg-subject { flex: 1; min-width: 160px; }
.msg-from { font-family: var(--mono); font-size: .72rem; }
.msg-body { padding: 0 4px 18px; }
.msg-text { margin: 12px 0; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); }
.message .mini-grid { grid-template-columns: repeat(auto-fill, 84px); }
.kv { margin: 0; }
.kv div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .84rem; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: .8rem; word-break: break-word; }
.logs { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.log-files { max-height: 70vh; overflow: auto; padding: 6px; }
.log-files a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; font: .78rem var(--mono); color: var(--muted); }
.log-files a.on, .log-files a:hover { color: var(--text); background: var(--surface-2); }
.log-view { overflow: hidden; }
.log-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.log-head form { margin: 0; }
.log-view pre { margin: 0; padding: 14px; max-height: 70vh; overflow: auto; font: .76rem/1.65 var(--mono); white-space: pre-wrap; word-break: break-all; }
.settings-form .tabs { margin-bottom: 20px; }
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; margin-top: 8px; padding: 16px 0; background: linear-gradient(transparent, var(--bg) 40%); }

/* ---------- installer ---------- */
.install { display: grid; gap: 16px; max-width: 680px; margin: 0 auto; }
.install-head { margin-bottom: 8px; text-align: center; }
.install-head .brand-mark { width: 36px; height: 36px; margin: 0 auto 16px; border-radius: 8px; }
.step { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; background: var(--text); color: var(--invert); font: 500 .7rem var(--mono); }
.checks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .86rem; }
.checks small { color: var(--muted); }
.check-dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; }
.check-dot .icon { width: 11px; height: 11px; }
.checks .ok .check-dot { background: var(--green); }
.checks .bad .check-dot { background: var(--red); }
.checks .warn .check-dot { background: var(--amber); }
.mysql-fields { margin-bottom: 16px; padding: 16px; border-radius: var(--r); background: var(--surface-2); }

/* ---------- footer ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(0, 1fr)); gap: 32px; padding: 52px 0 44px; }
.footer-about .brand { margin-bottom: 12px; }
.footer-about p { max-width: 270px; margin: 0 0 20px; font-size: .84rem; line-height: 1.6; color: var(--muted); }
.footer-col h3 { margin: 0 0 14px; font: 500 .7rem var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--text); }
.footer-col ul { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.footer-col a { font-size: .84rem; color: var(--muted); transition: color .15s; }
.footer-col a:hover { color: var(--text); }
.social { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.social a { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--muted); transition: color .15s, border-color .15s, background .15s, transform .15s; }
.social a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); transform: translateY(-1px); }
.social .icon { width: 16px; height: 16px; }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 18px 0 22px; border-top: 1px solid var(--line); font: .72rem var(--mono); color: var(--muted); }
.footer-credit a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.footer-credit a:hover { text-decoration-color: currentColor; }

/* ---------- responsive ---------- */
.show-sm { display: none; }
@media (max-width: 1000px) {
  .footer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-about { grid-column: 1 / -1; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .stats-row.four { grid-template-columns: repeat(2, 1fr); }
  .stats-row.four .stat:nth-child(2) { border-right: 0; }
  .stats-row.four .stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .nav { position: absolute; top: 56px; left: 0; right: 0; display: none; flex-direction: column; align-items: stretch; gap: 0; padding: 8px 24px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; animation: fade .15s ease; }
  .nav a { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
  .v-info { grid-template-columns: 1fr; gap: 16px; }
  .v-stage { height: clamp(240px, 54vh, 500px); margin: 8px 8px 0; padding: 12px; }
  .v-box-foot { margin-top: 8px; padding: 9px 12px; }
  .v-hint { display: none; }
  .stage-nav, .v-tools { opacity: 1; }
  .my-layout { grid-template-columns: 1fr; gap: 20px; }
  .album-list { position: static; }
  .settings-grid, .tool-grid, .dash-grid, .logs { grid-template-columns: 1fr; }
  .page-head-note { text-align: left; }
  .switches { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .nav { padding: 8px 16px 16px; }
  .page { padding-top: 24px; padding-bottom: 56px; }
  .hide-sm, .user-name { display: none; }
  .show-sm { display: inline-flex; }
  .two, .three, .seg-radio { grid-template-columns: 1fr; }
  .stats-row, .stats-row.four { grid-template-columns: 1fr 1fr; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 1.2rem; }
  .jtile figcaption { padding: 7px 9px 8px; }
  .up-head { flex-direction: column; align-items: stretch; }
  .uploader { padding: 0 14px 14px; }
  .up-head { margin: 0 -14px 14px; padding: 4px 14px 0; }
  .uploader .fine { margin: 14px -14px -14px; padding: 10px 14px; }
  .up-limits { display: none; }
  .tabs { gap: 16px; }
  .dropzone { min-height: 200px; }
  .dz-keys { display: none; }
  .opt { min-width: calc(50% - 4px); }
  .opt-go, .opt-go .btn { width: 100%; }
  .queue { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .rrow { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  .rrow-thumb { width: 40px; height: 40px; }
  .fmt-bar .btn { margin: 6px 0 8px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .search, .search input[type=search] { width: 100%; }
  .pad { padding: 18px; }
  .v-info > section { padding: 20px 18px; }
  .page-head { align-items: flex-start; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .inline-form { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px 20px; padding: 40px 0 32px; }
  .auth, .auth.solo { padding: 24px 20px 0; }
  .auth-foot { margin: 0 -20px; padding: 14px 20px; }
  .bulk-bar { bottom: 10px; }
}
@media (max-width: 440px) {
  .xs-hide { display: none; }
  .topbar-in { gap: 12px; }
  .top-actions { gap: 2px; }
  .tab > span { display: inline-block; }
  .tab > span::first-letter { text-transform: uppercase; }
}
@media (max-width: 1100px) {
  .jgrid, .member-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .jgrid, .member-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-bg { height: 560px; }
}
@media (max-width: 640px) {
  .jgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* Members turn into full-width rows: avatar, name and date, then the image count. */
  .member-grid { grid-template-columns: 1fr; gap: 8px; }
  .member { flex-direction: row; align-items: stretch; }
  .member-body { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; gap: 0 12px; padding: 12px 14px; text-align: left; }
  .member-body .avatar { grid-row: 1 / 3; width: 44px; height: 44px; margin: 0; font-size: 1.05rem; }
  .member-name { align-self: end; }
  .member-body small { align-self: start; }
  .member-body { position: relative; }
  .member-body:has(.member-badge) { padding-right: 62px; }
  .member-badge { top: 50%; right: 12px; transform: translateY(-50%); }
  .member-foot { flex-direction: column; justify-content: center; align-items: flex-end; gap: 2px; min-width: 92px; padding: 10px 14px; border-top: 0; border-left: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- colour layer ----------
   The layout stays monochrome; colour comes from the accent (Admin > Settings),
   per-member hues and a few tinted icons. */
:root { --accent-2: color-mix(in oklab, var(--accent), #ec4899 55%); --accent-ink: color-mix(in oklab, var(--accent), #000 12%); }
:root[data-theme="dark"] { --accent-ink: color-mix(in oklab, var(--accent), #fff 35%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --accent-ink: color-mix(in oklab, var(--accent), #fff 35%); } }

.brand-mark, .auth-mark { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.primary:hover { color: #fff; opacity: 1; background: var(--accent-ink); border-color: var(--accent-ink); }
.nav a.active { color: var(--accent-ink); }
.seg a.on, .seg button.on, .tab.active { border-bottom-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { background: #fff; }
.progress span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.pager .cur { background: var(--accent); color: #fff; }
.star.on, .star.hover { color: #f5a524; }
.badge.accent, .member-badge { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); color: var(--accent-ink); }
p a:hover, .prose a:hover, .link:hover, .field-link:hover, .auth-foot a:hover, .footer-credit a:hover { text-decoration-color: var(--accent); }
.footer-credit a { color: var(--accent-ink); }

.hero h1 em { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bg-grid { background-image: radial-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 1px, transparent 1.3px); }
.dz-icon { border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); color: var(--accent-ink); }
.dropzone:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* Avatars take a hue from the username (avatar_style() sets --h). */
.avatar { background: hsl(var(--h, 245) 48% 48%); color: #fff; }
.member .avatar { box-shadow: 0 0 0 4px hsl(var(--h, 245) 70% 60% / .16); }
.member-body { background: linear-gradient(hsl(var(--h, 245) 70% 60% / .10), transparent 70%); }
.member:hover { border-color: hsl(var(--h, 245) 60% 55% / .55); }
.member:hover .member-foot span:last-child { color: hsl(var(--h, 245) 48% 48%); }

.jtile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* Tools: each card gets its own tone. */
.tool { --c: var(--accent); }
.tone-blue { --c: #2f6bff; } .tone-violet { --c: #8b5cf6; } .tone-amber { --c: #e08a00; } .tone-green { --c: #12a150; }
.tool-ico { border-color: color-mix(in srgb, var(--c) 30%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); }
.tool:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.tool-kicker { color: var(--c); }
.tool-steps li::before { border-color: color-mix(in srgb, var(--c) 35%, transparent); color: var(--c); }
.tool-foot > a:hover span { color: var(--c); }

/* ---------- admin area: its own layout, apart from the public site ---------- */
.adm-body { background: var(--bg); }
.adm { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.adm-side { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); scrollbar-width: thin; }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; color: var(--text); }
.adm-brand .brand-mark { flex: none; width: 30px; height: 30px; border-radius: 7px; }
.adm-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.adm-brand-text b { overflow: hidden; font-size: .92rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; text-overflow: ellipsis; }
.adm-brand-text small { font: 500 .64rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.adm-nav { flex: 1; padding: 0 10px 16px; }
.adm-group { margin-top: 16px; }
.adm-group h3 { margin: 0 0 4px; padding: 0 10px; font: 500 .62rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.adm-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text-2); font-size: .86rem; transition: background .12s, color .12s; }
.adm-nav a .icon { flex: none; width: 16px; height: 16px; color: var(--muted); }
.adm-nav a:hover { background: var(--surface-2); color: var(--text); }
.adm-nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.adm-nav a.on .icon { color: var(--accent-ink); }
.adm-nav .count { margin-left: auto; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font: 600 .64rem/1.7 var(--mono); font-style: normal; text-align: center; }
.adm-side-foot { padding: 12px 20px; border-top: 1px solid var(--line); font: .7rem var(--mono); color: var(--faint); }
.adm-main { display: flex; flex-direction: column; min-width: 0; }
.adm-top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 32px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.adm-menu-btn { display: none; }
.adm-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .86rem; }
.adm-crumb span { color: var(--muted); }
.adm-crumb span::after { content: "/"; margin-left: 8px; color: var(--faint); }
.adm-crumb b { overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.adm-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.adm-content { width: 100%; max-width: 1180px; padding: 32px 32px 80px; }
.adm-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; padding: 10px 14px; border-radius: 6px; font-size: .86rem; }
.adm-banner .icon { width: 15px; height: 15px; }
.adm-banner.warning { border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.adm-banner a { margin-left: auto; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.adm-scrim { display: none; }
/* Tab bars (DMCA status, bulk tools, settings) keep a gap above the content below. */
.adm-content .tabs { margin-bottom: 20px; }

/* Admin sign in */
.adm-bare { display: grid; place-items: center; min-height: 100vh; background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 22%, transparent) 1px, transparent 1.3px); background-size: 24px 24px; }
.adm-bare-main { width: 100%; max-width: 440px; padding: 32px 16px; }
.adm-bare .flashes { margin-bottom: 16px; }
.adm-login.auth { margin: 0 auto; }
.adm-login-mark { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.adm-login-mark .auth-mark { margin: 0; }
.adm-login-cancel, .auth-alt { justify-content: center; margin: -14px 0 20px; text-align: center; }
.adm-bare-foot { margin-top: 18px; text-align: center; font-size: .84rem; color: var(--muted); }
.adm-bare-foot a:hover { color: var(--text); }
.otp-input { font: 500 1.25rem var(--mono); letter-spacing: .3em; text-align: center; }

/* Settings pages built from field lists */
.fstack { display: grid; gap: 16px; }
.fset-head { margin-bottom: 18px; }
.fset-head h2 { margin: 0 0 4px; font-size: .98rem; }
.fset-head p { margin: 0; }
.fset-head a, .fset small a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.fcell.wide { grid-column: 1 / -1; }
.fcell .switch { margin-bottom: 14px; }
.slug-row { display: flex; align-items: stretch; overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); }
.slug-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slug-row input { flex: 1; min-width: 70px; border: 0; border-radius: 0; box-shadow: none !important; font: .84rem var(--mono); }
.slug-pre, .slug-post { display: block; max-width: 48%; padding: 0 9px; overflow: hidden; background: var(--surface-2); color: var(--muted); font: .74rem/34px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.sub-head { margin: 20px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .86rem; font-weight: 600; }
.sub-head small { font-weight: 400; color: var(--muted); }
.code-pre { max-height: 240px; margin: 14px 0 0; padding: 12px 14px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font: .76rem/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; }
.mt { margin-top: 16px; }
.pre { white-space: pre-wrap; }
.badge.ok { border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--green); }
.badge.warn { border-color: color-mix(in srgb, var(--amber) 50%, transparent); color: var(--amber); }
.tab-count { padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font: 500 .66rem/1.6 var(--mono); }
.table.compact th, .table.compact td { padding: 8px 10px; }
.log-list { margin: 0; padding: 0; list-style: none; }
.log-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.log-list li:last-child { border-bottom: 0; }
.log-list li > :last-child { margin-left: auto; }
.twofa { margin-bottom: 16px; }
.twofa h2 .icon { color: var(--accent-ink); }
.twofa-steps { margin-bottom: 16px; }
.totp-key { margin: 0 6px; padding: 2px 8px; font-size: .86rem; letter-spacing: .08em; }
.captcha { min-height: 65px; margin-bottom: 16px; }

.page-editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.page-editor-head h2 { margin: 0; }
/* Page editor: Visual (rich text) and Code (HTML) views, like the WordPress classic editor. */
.rte { overflow: hidden; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rte [hidden] { display: none !important; }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rte-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; transition: opacity .15s; }
.rte-tools select { width: auto; height: 30px; padding-left: 9px; font-size: .82rem; }
.rte-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; }
.rte-btn:hover { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.rte-btn.on { background: var(--accent-soft); color: var(--accent-ink); }
.rte-btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.rte-btn .icon { width: 16px; height: 16px; }
.rte-sep { width: 1px; height: 18px; margin: 0 5px; background: var(--line-2); }
.rte-modes { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); }
.rte-mode { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px; border: 0; border-radius: 4px; background: none; color: var(--muted); font: 500 .8rem var(--font); cursor: pointer; }
.rte-mode .icon { width: 14px; height: 14px; }
.rte-mode.on { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.rte.is-code .rte-tools { opacity: .35; pointer-events: none; }
.rte-visual { min-height: 380px; max-height: 70vh; padding: 18px 22px; overflow: auto; outline: none; }
.rte-visual > :first-child { margin-top: 0; }
.rte-code { display: block; width: 100%; min-height: 380px; padding: 16px 18px; border: 0 !important; border-radius: 0; box-shadow: none !important; font: .8rem/1.65 var(--mono); resize: vertical; }
.rte-help { margin: 8px 0 18px; }
.mail-test { margin-top: -4px; }

/* Password tools: generator, show/hide, strength meter. */
.pw-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; font-weight: 500; font-size: .82rem; color: var(--text-2); }
.pw-gen { margin-left: auto; font-size: .8rem; color: var(--accent-ink); }
.pw-gen .icon { width: 13px; height: 13px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; font-family: var(--mono); }
.pw-wrap input[type=password] { font-family: var(--font); }
.pw-eye { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.pw-eye:hover, .pw-eye.on { background: var(--surface-2); color: var(--text); }
.pw-meter { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--line); }
.pw-meter span { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--red); transition: width .2s, background .2s; }
.pw-meter[data-score="2"] span { background: var(--amber); }
.pw-meter[data-score="3"] span, .pw-meter[data-score="4"] span { background: var(--green); }
.pw-hint { display: block; margin-top: 5px; font-size: .74rem; color: var(--muted); }

/* Account security section and recovery codes. */
.sec-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.sec-row b { font-weight: 500; font-size: .9rem; }
.sec-row p { margin: 2px 0 0; }
.sec-row .switch { padding: 0; border: 0; }
.sec-row .switch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sec-line { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.sec-form { flex-wrap: wrap; }
.recovery { margin: 12px 0 16px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); border-radius: 8px; background: color-mix(in srgb, var(--amber) 7%, var(--surface)); }
.recovery-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.recovery-head .icon { width: 15px; height: 15px; vertical-align: -2px; }
.recovery p { margin: 6px 0 10px; }
.recovery-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0; padding-left: 20px; font-size: .86rem; }
.recovery-list code { letter-spacing: .06em; }

/* Social link fields: an ordered list with drag handles, detected network name and icon. */
.social-list { display: grid; gap: 8px; margin-bottom: 16px; }
.social-list-hint { margin: 4px 0 4px; }
.social-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); transition: border-color .15s, box-shadow .15s, opacity .15s; }
.social-row:hover { border-color: var(--line-2); }
.social-row.dragging { opacity: .5; border-style: dashed; border-color: var(--accent); }
.social-handle { display: grid; place-items: center; width: 22px; height: 30px; color: var(--muted); cursor: grab; }
.social-row:hover .social-handle { color: var(--text-2); }
.social-handle:active { cursor: grabbing; }
.social-num { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font: 500 .72rem var(--mono); }
.social-row .social-input { flex: 1; min-width: 0; }
.social-name { flex: none; width: 92px; overflow: hidden; font-size: .8rem; font-weight: 500; color: var(--accent-ink); white-space: nowrap; text-overflow: ellipsis; }
.social-move { display: flex; flex: none; gap: 2px; }
.social-move .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.social-input { position: relative; display: block; }
.social-input input { padding-left: 38px; }
.social-ico { position: absolute; top: 50%; left: 11px; display: grid; place-items: center; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.social-ico .icon { width: 16px; height: 16px; }
.social-input:focus-within .social-ico { color: var(--accent-ink); }

/* Account deletion confirmation. */
.danger-box { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.danger-mark { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 16px; border-radius: 8px; background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.danger-list { margin: 0 0 22px; padding-left: 18px; color: var(--text-2); font-size: .88rem; line-height: 1.6; }
.danger-list li + li { margin-top: 6px; }

/* Ad slots on image pages and the favicon picker. */
.ad-slot { display: flex; justify-content: center; min-height: 0; overflow: hidden; text-align: center; }
.ad-slot > * { max-width: 100%; }
.sub-head.first { margin-top: 0; padding-top: 0; border-top: 0; }
.favicon-row { display: flex; align-items: flex-start; gap: 18px; }
.favicon-row > div { flex: 1; min-width: 0; }
.favicon-preview { display: grid; place-items: center; flex: none; width: 72px; height: 72px; margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.favicon-preview img { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; }

/* Database, DMCA and bulk tools */
.db-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.db-action { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: start; }
.db-action h2 { margin: 0 0 2px; font-size: .92rem; }
.db-action p { margin: 0; }
.db-action .btn { grid-column: 2; justify-self: start; margin-top: 10px; }
.db-action .tool-ico { --c: var(--accent); }
.db-result { margin-bottom: 16px; border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.dmca-form h2 { margin: 24px 0 12px; font-size: .92rem; }
.dmca-form h2:first-of-type { margin-top: 0; }
.dmca-form .check { align-items: flex-start; line-height: 1.5; }
.dmca-form .check input { flex: none; margin-top: 3px; }
.dmca-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.dmca-side { display: grid; gap: 16px; }
.dmca-images { display: grid; gap: 8px; margin-bottom: 14px; }
.dmca-img { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.dmca-img:has(input:checked) { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); background: color-mix(in srgb, var(--red) 5%, transparent); }
.dmca-img img { width: 52px; height: 52px; border-radius: 4px; background: var(--surface-2); object-fit: cover; }
.bulk-drop { min-height: 200px; margin-top: 4px; }
.bulk-drop b { font-weight: 500; }
.bulk-status { margin-top: 16px; }
.bulk-status .progress { height: 4px; margin: 10px 0; }
.bulk-errors { max-height: 180px; margin: 0; padding-left: 18px; overflow: auto; color: var(--red); font-size: .82rem; }
.bulk-sample { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; margin: 12px 0 16px; }
.bulk-sample img { width: 100%; aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); object-fit: cover; }

/* Announcement bar on the public site */
.announce { position: relative; background: var(--accent); color: #fff; font-size: .86rem; }
.announce.success { background: var(--green); }
.announce.warning { background: var(--amber); }
/* The message stays centred; the close button sits at the far right of the bar. */
.announce-in { display: flex; align-items: center; justify-content: center; min-height: 38px; padding-top: 6px; padding-bottom: 6px; padding-right: 48px; padding-left: 48px; text-align: center; }
.announce-x { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); display: grid; place-items: center; padding: 3px; border: 0; border-radius: 4px; background: none; color: inherit; opacity: .8; cursor: pointer; }
.announce-x:hover { opacity: 1; background: rgba(255, 255, 255, .15); }

@media (max-width: 1000px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .adm-open .adm-side { transform: none; }
  .adm-open .adm-scrim { position: fixed; z-index: 60; inset: 0; display: block; background: rgba(0, 0, 0, .4); }
  .adm-menu-btn { display: inline-grid; margin-left: -8px; }
  .dmca-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .adm-top { padding: 0 16px; }
  .adm-content { padding: 24px 16px 56px; }
  .adm-crumb span { display: none; }
  .fgrid { grid-template-columns: 1fr; }
  .bulk-sample { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .social-name { display: none; }
}

/* Updates page: link to the latest version. */
.update-check { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.update-check h2 { margin-bottom: 4px; }
.update-check p { margin: 0; }
@media (max-width: 640px) { .update-check { flex-direction: column; align-items: flex-start; } }
