/* cosbot panel. One hand-written stylesheet: tokens first, then layout, then components.
   Dark by default (follows the device), light via the toggle (html[data-theme]). */

:root {
  --bg: #0d0e12;
  --surface: #15171d;
  --surface-2: #1c1f27;
  --surface-3: #242833;
  --border: #272b36;
  --text: #eceef3;
  --muted: #8c93a3;
  --faint: #5d6474;
  --accent: #8b6cff;
  --accent-2: #a58dff;
  --accent-soft: rgba(139, 108, 255, .14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, .14);
  --nude: #f472b6;
  --nude-soft: rgba(244, 114, 182, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .18);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --tap: 44px;
  --sidebar: 232px;
  --tabbar: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eceef3;
  --border: #e3e6ec;
  --text: #151821;
  --muted: #646b7b;
  --faint: #9aa1b0;
  --accent: #6d4aff;
  --accent-2: #5a36f0;
  --accent-soft: rgba(109, 74, 255, .10);
  --ok: #059669; --ok-soft: rgba(5, 150, 105, .10);
  --warn: #b45309; --warn-soft: rgba(217, 119, 6, .12);
  --bad: #dc2626; --bad-soft: rgba(220, 38, 38, .10);
  --nude: #db2777; --nude-soft: rgba(219, 39, 119, .10);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 var(--s2); }
code, pre { font-family: var(--mono); font-size: 13px; }
pre { background: var(--surface-2); border: 1px solid var(--border); padding: var(--s3); border-radius: var(--r-sm); overflow-x: auto; margin: 0 0 var(--s3); }
img { max-width: 100%; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.okc { color: var(--ok); } .warnc { color: var(--warn); } .err, .badc { color: var(--bad); }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hide { display: none !important; }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.sidebar { display: none; }
.content { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s4) var(--s3);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { flex: 1; font-size: 20px; }
.page { max-width: 1120px; margin: 0 auto; padding: var(--s2) var(--s4) var(--s6); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin: var(--s2) 0 var(--s4); flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: var(--s1); }
.section { margin: var(--s5) 0 var(--s3); display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.cols { display: grid; gap: var(--s4); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 550; position: relative; text-decoration: none; }
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a.on { color: var(--accent-2); }
.tabbar .dot { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .app { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: var(--s4) var(--s3); background: var(--surface); border-right: 1px solid var(--border);
  }
  .sidebar .brand { display: flex; align-items: center; gap: var(--s2); font-weight: 750; font-size: 17px; padding: var(--s2) var(--s3) var(--s4); color: var(--text); text-decoration: none; }
  .sidebar .brand .logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #ff6fb5); display: grid; place-items: center; color: #fff; font-size: 15px; }
  .sidebar .group { font-size: 11px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: var(--s4) var(--s3) var(--s1); }
  .sidebar a.nav { display: flex; align-items: center; gap: var(--s3); padding: 9px var(--s3); border-radius: var(--r-sm); color: var(--muted); font-weight: 550; text-decoration: none; }
  .sidebar a.nav:hover { background: var(--surface-2); color: var(--text); }
  .sidebar a.nav.on { background: var(--accent-soft); color: var(--accent-2); }
  .sidebar a.nav .count { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; min-width: 18px; text-align: center; }
  .sidebar .foot { margin-top: auto; display: flex; gap: var(--s2); padding: var(--s3); }
  .topbar { display: none; }
  .page { padding: var(--s5) var(--s6) var(--s6); }
  .cols.two { grid-template-columns: 1fr 1fr; }
  .cols.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}

/* ---------- cards & lists ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s4); margin: 0 0 var(--s3); }
.card.flush { padding: 0; overflow: hidden; }
.card.tint { background: var(--surface-2); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.card-h .sub { color: var(--muted); font-size: 13px; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); min-height: 56px; color: inherit; text-decoration: none; }
.item:first-child { border-top: 0; }
a.item:hover { background: var(--surface-2); text-decoration: none; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { color: var(--muted); font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.item .thumb { width: 48px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-3); flex: none; }
.item .side { display: flex; gap: var(--s1); align-items: center; flex: none; }
.dotsep::before { content: "·"; margin-right: 6px; color: var(--faint); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats.wide { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s3) var(--s4); }
.stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.accent b { color: var(--accent-2); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); } .stat.ok b { color: var(--ok); }

/* ---------- buttons ---------- */
.btn, button {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4); border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; position: relative;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover, button:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, button:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--accent-2); }
.btn.ok, button.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn.danger, button.danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm, button.sm { min-height: 34px; padding: 0 var(--s3); font-size: 13px; border-radius: 10px; }
.btn.icon-only, button.icon-only { width: var(--tap); padding: 0; }
.btn.sm.icon-only, button.sm.icon-only { width: 34px; }
.btn.block, button.block { width: 100%; }
.btn.lg, button.lg { min-height: 56px; font-size: 16px; border-radius: 16px; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.btn-row.fill > * { flex: 1 1 0; }
button.htmx-request, .htmx-request > button[type=submit], .htmx-request button.primary { color: transparent !important; }
button.htmx-request::after, .htmx-request > button[type=submit]::after, .htmx-request button.primary::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent; animation: spin .8s linear infinite;
}
button.primary.htmx-request::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* big posting switch */
.power { display: flex; align-items: center; gap: var(--s4); width: 100%; padding: var(--s4); border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); text-align: left; min-height: 76px; }
.power .knob { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.power .knob .icon { width: 26px; height: 26px; }
.power b { display: block; font-size: 17px; }
.power span { color: var(--muted); font-size: 13px; font-weight: 500; }
.power.running .knob { background: var(--ok-soft); color: var(--ok); }
.power.paused .knob { background: var(--warn-soft); color: var(--warn); }
.power.paused { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-weight: 400; color: var(--faint); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; width: 100%; min-height: var(--tap);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.check { display: flex; align-items: center; gap: var(--s3); font-size: 15px; font-weight: 500; color: var(--text); min-height: var(--tap); cursor: pointer; }
.check input[type=checkbox], .check input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; }
/* iOS-style switch: <label class="toggle"><input type="checkbox"><span></span> text</label> */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 52px; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; border-top: 1px solid var(--border); }
.toggle:first-child { border-top: 0; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle i { width: 46px; height: 28px; border-radius: 14px; background: var(--surface-3); position: relative; flex: none; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(18px); }
.toggle input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; gap: var(--s3); }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

/* ---------- chips, pills, tabs ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.pill.ok, .pill.clean { background: var(--ok-soft); color: var(--ok); }
.pill.warn, .pill.unsure { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.nude { background: var(--nude-soft); color: var(--nude); }
.pill.accent { background: var(--accent-soft); color: var(--accent-2); }
.tag { display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg label { flex: 1 0 auto; text-align: center; padding: 7px 12px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer; }
.seg a.on, .seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg label { padding: 0; display: flex; }
.seg label input { position: absolute; opacity: 0; width: 0; }
.seg label span { flex: 1; padding: 7px 12px; border-radius: 9px; }
.seg .n { color: var(--faint); margin-left: 4px; font-weight: 500; }
.chips { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding: 2px 0 var(--s2); margin: 0 calc(-1 * var(--s4)) var(--s2); padding-left: var(--s4); padding-right: var(--s4); }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; }
.chips a b { color: var(--muted); font-weight: 600; }
.chips a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips a.on b { color: rgba(255,255,255,.8); }

/* ---------- photo grid ---------- */
/* size S / M / L (html[data-grid], switch on the gallery page): fixed columns on a phone, tile width above */
.photos { --cols: 3; --tile: 170px; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; margin: 0 calc(-1 * var(--s4)); }
html[data-grid="s"] .photos { --cols: 4; --tile: 112px; }
html[data-grid="l"] .photos { --cols: 2; --tile: 260px; }
@media (min-width: 640px) { .photos { grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 8px; margin: 0; } }
.gridsize button { min-height: 0; height: 30px; width: 34px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.gridsize button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.ph .zoom { position: absolute; right: 6px; top: 30px; z-index: 3; width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 8px; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: .85; }
.ph .zoom .icon { width: 15px; height: 15px; }
@media (hover: hover) { .ph .zoom { opacity: 0; transition: opacity .15s; } .ph:hover .zoom { opacity: 1; } }
.card .photos { margin: 0 calc(-1 * var(--s4)); }
@media (min-width: 640px) { .card .photos { margin: 0; } }
.ph { position: relative; overflow: hidden; background: var(--surface-3); aspect-ratio: 3 / 4; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
@media (min-width: 640px) { .ph { border-radius: 10px; } }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .25s, transform .25s; }
.ph::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%) var(--surface-3); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.ph.loaded::before { display: none; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.ph .badge { position: absolute; right: 6px; bottom: 6px; z-index: 2; }
.ph .badge.pill { height: 20px; font-size: 11px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ph .pill.clean { background: rgba(6, 95, 70, .72); color: #a7f3d0; }
.ph .pill.nude { background: rgba(131, 24, 67, .78); color: #fbcfe8; }
.ph .pill.unsure { background: rgba(120, 53, 15, .78); color: #fde68a; }
.ph .num { position: absolute; left: 6px; top: 6px; z-index: 2; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,.5); border-radius: 6px; padding: 1px 6px; backdrop-filter: blur(6px); }
.ph .who { position: absolute; left: 6px; bottom: 6px; z-index: 2; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; background: rgba(0,0,0,.5); }
.ph .who.human { background: var(--accent); }
.ph .flag { position: absolute; right: 6px; top: 6px; z-index: 2; font-size: 10px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 6px; padding: 1px 6px; }
.ph.inprev { box-shadow: inset 0 0 0 3px var(--ok); }
.ph.sel { box-shadow: inset 0 0 0 4px var(--accent); }
.ph.sel::after { content: "✓"; position: absolute; top: 6px; right: 6px; z-index: 3; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
html.blur .ph.nsfw:not(.shown) img { filter: blur(18px) saturate(.6); transform: scale(1.1); }
html.blur .ph.nsfw:not(.shown)::after { content: "нажмите, чтобы показать"; position: absolute; inset: auto 0 40% 0; z-index: 2; text-align: center; font-size: 11px; font-weight: 600; color: rgba(255,255,255,.85); }
.ph .box { position: absolute; z-index: 2; border: 2px solid #fb7185; border-radius: 4px; display: none; }
.ph .box i { position: absolute; left: -2px; top: -18px; background: #fb7185; color: #fff; font-size: 10px; font-style: normal; font-weight: 700; padding: 1px 4px; border-radius: 4px; white-space: nowrap; }
.ph.boxes .box { display: block; }
.ph.flash { animation: flash .5s; }
@keyframes flash { from { box-shadow: inset 0 0 0 4px var(--accent-2); } }

.selbar {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--s2)); z-index: 15; margin-top: var(--s3);
  display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow-x: auto; scrollbar-width: none;
}
.selbar::-webkit-scrollbar { display: none; }
.selbar .count { padding: 0 var(--s2); font-weight: 700; white-space: nowrap; }
.selbar button { flex: none; }
@media (min-width: 960px) { .selbar { bottom: var(--s3); } }

/* ---------- misc components ---------- */
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--warn-soft); color: var(--text); margin-bottom: var(--s2); text-decoration: none; border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.alert .icon { color: var(--warn); margin-top: 1px; }
.alert.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert.bad .icon { color: var(--bad); }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert.info .icon { color: var(--accent-2); }
a.alert:hover { text-decoration: none; filter: brightness(1.08); }
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--faint); margin-bottom: var(--s2); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
details.more > summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; padding: var(--s2) 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; } details.more[open] > summary::before { content: "▾ "; }
.caption-preview { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); font-size: 14px; line-height: 1.5; }
.timeline .item { align-items: flex-start; }
.timeline time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 78px; padding-top: 2px; }
.timeline .undone .title { text-decoration: line-through; color: var(--faint); }
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 72px; }
.spark i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.spark i:hover { opacity: 1; }
.job { display: inline-flex; align-items: center; gap: var(--s2); font-size: 13px; font-weight: 600; padding: var(--s2) var(--s3); border-radius: 10px; background: var(--surface-2); margin-top: var(--s2); }
.job-running, .job-queued { color: var(--warn); } .job-done { color: var(--ok); } .job-failed { color: var(--bad); }
.job-running::before, .job-queued::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.login .card { width: 100%; max-width: 380px; padding: var(--s5); box-shadow: var(--shadow); }
.login .logo { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), #ff6fb5); display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 800; margin-bottom: var(--s4); }

/* trainer */
.trainer-stage { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #000; touch-action: pan-y; }
.trainer-stage img.crop { display: block; width: 100%; max-height: 58vh; object-fit: contain; transition: transform .2s; }
.trainer-stage .ctx { position: absolute; right: var(--s3); bottom: var(--s3); width: 72px; border-radius: 10px; border: 2px solid rgba(255,255,255,.7); box-shadow: var(--shadow); }
.trainer-stage .info { position: absolute; left: var(--s3); top: var(--s3); display: flex; gap: 6px; flex-wrap: wrap; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s3); }
.answers button { min-height: 64px; font-size: 16px; border-radius: 16px; }
.answers .skip { grid-column: 1 / 3; min-height: var(--tap); }

/* toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--s3)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; padding: 0 var(--s4); }
@media (min-width: 960px) { #toasts { bottom: var(--s5); left: var(--sidebar); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s3); max-width: 520px; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 550; box-shadow: var(--shadow); animation: toast-in .25s ease-out, toast-out .3s ease-in 5s forwards; }
.toast:not(:has(button)) { padding-right: 16px; }
.toast:has(.job-queued, .job-running) { animation: toast-in .25s ease-out; }  /* stays until the job ends */
.toast .job { margin: 0; background: transparent; padding: 0; }
.toast button { min-height: 32px; padding: 0 12px; border-radius: 9px; background: transparent; border: 1px solid color-mix(in srgb, var(--bg) 30%, transparent); color: var(--bg); font-size: 13px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; visibility: hidden; } }

/* htmx swaps */
.htmx-added { animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.skeleton { border-radius: var(--r); height: 120px; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--border); }
.page-head h1.desk { display: none; }
@media (min-width: 960px) { .page-head h1.desk { display: block; } }
.page-head:empty { display: none; }
.cols > * { min-width: 0; }
details.item > summary::-webkit-details-marker { display: none; }

/* ---------- live page: loading hint, working buttons, cards that were acted on ---------- */
html.loading .content { opacity: .6; transition: opacity .2s .15s; }
html.loading { cursor: progress; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid var(--muted); border-right-color: transparent; animation: spin .7s linear infinite; }
.gone { opacity: .35; pointer-events: none; transition: opacity .25s; }
.row.quick { margin-top: 6px; }
.row.quick:not(:has(button)) { display: none; }
@media (min-width: 960px) { .item .thumb { width: 60px; height: 80px; } }

/* ---------- fullscreen photo viewer ---------- */
html.lb-open, html.lb-open body { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 6, 9, .96); display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.lightbox[hidden] { display: none; }
.lb-top { position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: var(--s2); padding: calc(env(safe-area-inset-top) + 10px) var(--s3) 10px; background: linear-gradient(rgba(0,0,0,.6), transparent); color: #fff; }
.lb-pos { font-weight: 700; font-size: 14px; white-space: nowrap; }
.lb-who { color: rgba(255,255,255,.65); font-size: 12px; white-space: nowrap; }
.lb-top .pill.clean { background: rgba(6, 95, 70, .85); color: #a7f3d0; }
.lb-top .pill.nude { background: rgba(131, 24, 67, .9); color: #fbcfe8; }
.lb-top .pill.unsure { background: rgba(120, 53, 15, .9); color: #fde68a; }
.lb-top button, .lb-top .btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 0 env(safe-area-inset-bottom); }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: filter .2s; }
.lb-hint { display: none; position: absolute; color: rgba(255,255,255,.85); font-weight: 600; pointer-events: none; }
.lightbox.blurred .lb-stage img { filter: blur(28px) saturate(.6); cursor: pointer; }
.lightbox.blurred .lb-hint { display: block; }
.lb-nav { position: absolute; top: 50%; z-index: 2; width: 48px; height: 72px; margin-top: -36px; padding: 0; border: 0; border-radius: 12px; background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; }
.lb-nav:disabled { opacity: .15; }
.lb-nav.prev { left: 12px; } .lb-nav.next { right: 12px; }
@media (hover: none) { .lb-nav { display: none; } }
@media (min-width: 960px) { .lb-stage { padding: 64px 72px 24px; } }

/* ---------- progress: what the services are doing ---------- */
.prog { margin-top: 6px; display: grid; gap: 4px; }
.prog .bar { height: 6px; }
.bar.indet > i { width: 35%; animation: indet 1.2s ease-in-out infinite alternate; }
@keyframes indet { from { transform: translateX(-10%); } to { transform: translateX(200%); } }
.now { display: grid; gap: var(--s3); }
.now-row { display: flex; gap: var(--s3); align-items: flex-start; }
.now-row + .now-row { border-top: 1px solid var(--border); padding-top: var(--s3); }
.now-ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.now-row .main { flex: 1; min-width: 0; }
.now-row .main > a b { overflow-wrap: anywhere; }
.pushed { display: block; margin-top: 4px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
