:root {
  --bg: #f7f4f1; --panel: #ffffff; --ink: #1d1a1f; --muted: #7a7380; --line: #e8e2e4;
  --accent: #d64d7a; --accent-ink: #fff; --chip: #f1ebee; --shadow: 0 6px 24px rgba(40, 20, 30, .08);
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
[data-theme="dark"] {
  --bg: #121015; --panel: #1b181f; --ink: #f1ecf2; --muted: #9a92a2; --line: #2c2731;
  --accent: #ff6f9c; --accent-ink: #1b0b12; --chip: #26212b; --shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body.locked { overflow: hidden; }
a { color: inherit; }
kbd { font: 11px/1 ui-monospace, monospace; padding: 3px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--panel); }
.muted { color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 14px; align-items: center; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 18px; text-decoration: none; white-space: nowrap; }
.brand .mark { color: var(--accent); }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; padding: 10px 0; min-width: 0; }
.top-actions { display: flex; gap: 8px; margin-left: auto; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.icon { width: 38px; justify-content: center; padding: 9px 0; background: var(--chip); color: var(--ink); }
.btn.danger { background: #c0392b; color: #fff; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; font-size: 13px; }

.draft-bar { background: #ffe7a6; color: #4b3a00; padding: 8px 24px; font-size: 13px; }
.draft-bar a { font-weight: 700; margin-left: 8px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px 60px; }
.hero { padding: 40px 0 18px; }
.eyebrow { letter-spacing: .18em; font-size: 11px; color: var(--accent); font-weight: 700; margin: 0 0 8px; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); margin: 0 0 8px; }
.sub { color: var(--muted); max-width: 640px; margin: 0; line-height: 1.6; }
.stats { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; min-width: 130px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 12px; }

.spotlight { margin: 18px 0 8px; }
.spot-label { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 10px; }
.spot { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow); }
.spot-banner, .det-banner { height: 120px; background-image: var(--banner, none), linear-gradient(120deg, #f6c1d2, #c8b6f0); background-size: cover; background-position: center; }
.spot-main { display: flex; gap: 16px; padding: 0 20px 18px; }
.spot-main .av { margin-top: -34px; border: 4px solid var(--panel); }
.spot-main > div { padding-top: 12px; min-width: 0; }

.controls { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin: 26px 0 16px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.tab i { font-style: normal; color: var(--muted); margin-left: 6px; font-size: 12px; }
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab.on i { color: inherit; opacity: .7; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; }
.density { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.density button { border: 0; background: var(--panel); color: var(--muted); padding: 6px 10px; cursor: pointer; }
.density button.on { background: var(--chip); color: var(--ink); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid[data-density="1"] { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.grid[data-density="3"] { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid[data-density="3"] .bio, .grid[data-density="3"] .chips { display: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s; outline: none; }
.card:hover, .card:focus { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-top { display: flex; gap: 12px; align-items: center; }
.who { min-width: 0; }
.name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bio { color: var(--ink); opacity: .85; font-size: 13.5px; line-height: 1.55; margin: 12px 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bio.full { -webkit-line-clamp: unset; display: block; white-space: pre-wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.chip.model { color: var(--accent); }
.chip.prompt { color: #5a8f6a; }
.badge.lost { font-size: 11px; background: #555; color: #fff; padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 2px; }

.av { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #f3b2c8, #b7a4ec); display: inline-block; }
.av::before { content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 76px; height: 76px; font-size: 24px; }
.av.xl { width: 92px; height: 92px; font-size: 30px; margin-top: -50px; border: 4px solid var(--panel); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 12, .55); display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.sheet { position: relative; width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); }
.sheet.narrow { padding: 24px; width: min(420px, 100%); }
.close { position: absolute; top: 10px; right: 12px; z-index: 2; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; font-size: 20px; cursor: pointer; }
.det { padding: 0 24px 24px; }
.det h2 { margin: 10px 0 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.warn { background: #fff1e6; color: #8a4b12; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.row-end { display: flex; justify-content: flex-end; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1240px; margin: 0 auto; padding: 20px 24px 40px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

/* admin */
.admin-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; margin-top: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.field { display: grid; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select { width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; }
.field textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list td .av { width: 30px; height: 30px; font-size: 12px; }
table.list tr.sel { background: var(--chip); }
.status-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--chip); }
.status-pill.active { color: #2f8f4e; }
.status-pill.suspended, .status-pill.gone { color: #b03a3a; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .wrap { padding: 0 14px 40px; }
  .grid[data-density="1"] { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .top-actions .btn:not(.icon) { padding: 8px 10px; }
}
