:root {
  --bg: #f5f6f8;
  --fg: #1c1e21;
  --muted: #6b7280;
  --line: #d7dade;
  --acc: #1a56db;
  --err: #c0392b;
  --card: #ffffff;
}
* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
}
a { color: var(--acc); }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.4rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.top nav a { margin-left: 1rem; }
.who { color: var(--muted); margin-left: 1rem; }
main { padding: 1.4rem; }
h1 { margin: 0 0 0.4rem; font-size: 1.4rem; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.2rem;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }
.card input {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 0.45rem 0.5rem;
}
.card button {
  background: #e7eefc;
  color: var(--fg);
  border: 1px solid #b9c6dd;
  padding: 0.5rem;
  cursor: pointer;
}
table.list { width: 100%; border-collapse: collapse; margin-top: 1rem; }
table.list th, table.list td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
table.list th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.mono { font-family: ui-monospace, monospace; font-size: 0.9rem; }
.flash { color: #1a7f37; }
form.inline { display: inline; margin: 0; }
.bar { margin: 0.8rem 0 1rem; }
.split { display: grid; grid-template-columns: 16rem 1fr; gap: 1.2rem; }
.convos { list-style: none; margin: 0; padding: 0; }
.convos li { border-bottom: 1px solid var(--line); }
.convos a { display: block; padding: 0.45rem 0.2rem; text-decoration: none; color: var(--fg); }
.convos a span { display: block; color: var(--muted); font-size: 0.8rem; }
.convos .on { background: #dbe7ff; }
.convos .scam strong { color: #c0392b; }
.thread { max-height: 28rem; overflow: auto; display: flex; flex-direction: column; gap: 0.45rem; }
.bubble { max-width: 80%; padding: 0.4rem 0.6rem; border-radius: 8px; background: #eef0f3; }
.bubble.me { align-self: flex-end; background: #e7eefc; }
.bubble time { display: block; font-size: 0.7rem; color: var(--muted); }
.send { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.send textarea { flex: 1; background: #ffffff; color: var(--fg); border: 1px solid var(--line); padding: 0.4rem; }
.send button { background: #e7eefc; color: var(--fg); border: 1px solid #b9c6dd; padding: 0.4rem 0.8rem; cursor: pointer; }
.photo-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e7eefc; color: var(--fg); border: 1px solid #b9c6dd;
  padding: 0.4rem 0.6rem; cursor: pointer; font-size: 1rem;
}
.photo-btn input { display: none; }
form.inline button {
  background: #e7eefc;
  color: var(--fg);
  border: 1px solid #b9c6dd;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
}

/* ---------- SPA ---------- */
.spa-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tabs button {
  background: #ffffff;
  color: var(--fg);
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.tabs button.on { background: #e7eefc; border-color: #3a4a64; }
.badge {
  display: inline-block;
  margin-left: 0.3rem;
  background: #c0392b;
  color: #fff;
  border-radius: 9px;
  font-size: 0.7rem;
  padding: 0 0.4rem;
  line-height: 1.2;
}
.spa-hunter { display: flex; align-items: center; gap: 0.6rem; }
.spa-hunter label { color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 0.4rem; }
.hunter-sel {
  background: #ffffff; color: var(--fg); border: 1px solid var(--line); padding: 0.35rem 0.5rem;
}
button.mini {
  background: #e7eefc; color: var(--fg); border: 1px solid #b9c6dd;
  padding: 0.25rem 0.6rem; cursor: pointer; font-size: 0.8rem;
}
button.mini[disabled] { opacity: 0.5; cursor: not-allowed; }
.alert {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  margin-bottom: 1rem;
  background: #ffffff;
}
.alert.err { border-color: var(--err); color: var(--err); }
.alert.scam { border-color: var(--err); color: #c0392b; background: #fdecea; }
.statrow { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  padding: 0.7rem 1.1rem; min-width: 7rem; text-align: center;
}
.stat-num { font-size: 1.4rem; font-weight: 700; }
.stat-lbl { color: var(--muted); font-size: 0.75rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.8rem; }
.card.mini-card { padding: 0.8rem; }
.c-name { font-weight: 600; margin-top: 0.4rem; }
.c-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; display: inline-block; }
.avatar.ph {
  background: linear-gradient(135deg, #667eea, #a78bfa);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.avatar.ph.f { background: linear-gradient(135deg, #f093fb, #f5576c); }
.row-on { background: #dbe7ff; }
.scam-row td:first-child { border-left: 3px solid var(--err); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.scam-tag { display: inline-block; background: var(--err); color: #fff; border-radius: 4px; padding: 0 0.4rem; font-weight: 600; }
.bilder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; align-items: start; }
.bilder-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.bilder-card h3 { margin: 0 0 0.75rem; font-size: 15px; }
.bilder-main { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; border: 3px solid var(--line); display: block; margin: 0 auto 0.5rem; }
.bilder-key { font-size: 11px; word-break: break-all; text-align: center; }
#uploadForm { display: flex; flex-direction: column; gap: 0.75rem; }
.up-target { display: flex; align-items: center; gap: 0.4rem; font-size: 14px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.5rem; }
.album-photo { position: relative; }
.album-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.album-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: 0; border-radius: 6px; cursor: pointer; padding: 2px 6px; }
.album-miss { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.acc-actions { white-space: nowrap; }
.acc-actions .btn { margin-left: 0.25rem; }
.btn.sm { padding: 2px 8px; font-size: 12px; }
.btn.danger { background: var(--err); color: #fff; }
.btn.danger:hover { filter: brightness(1.1); }
#accEditForm { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
#accEditForm label { font-size: 13px; color: var(--muted); margin-bottom: -0.25rem; }
#addAccForm { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.t-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.t-head h2 { margin: 0 0 0.4rem; }
.bubble.scam-b { border: 1px solid var(--err); }

/* Media in messages */
.message-media {
  margin: 0.4rem 0;
  max-width: 200px;
  border-radius: 8px;
  overflow: hidden;
}

.message-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.message-sticker {
  max-width: 120px;
}

.sticker-badge {
  display: inline-block;
  background: #f3f5f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 1.4rem;
}

.media-miss {
  color: var(--muted);
  font-size: 0.8rem;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #ffffff; border: 1px solid var(--line);
  max-width: 42rem; width: 92%; max-height: 84vh; overflow: auto;
  padding: 1.2rem; position: relative;
}
.modal-close {
  position: absolute; top: 0.4rem; right: 0.6rem;
  background: none; border: none; color: var(--fg); font-size: 1.3rem; cursor: pointer;
}
.thread.small { max-height: 24rem; overflow: auto; }
.member {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.member .avatar { width: 30px; height: 30px; font-size: 14px; }
.m-title { color: var(--muted); font-size: 0.75rem; margin: 0.6rem 0 0.2rem; text-transform: uppercase; letter-spacing: 0.04em; }
.wheel-box { text-align: center; max-width: 22rem; margin: 0 auto; }
.wheel {
  width: 14rem; height: 14rem; border-radius: 50%; margin: 1rem auto;
  border: 6px solid #c7ccd3; position: relative;
  background: conic-gradient(
    #e74c3c 0deg 72deg, #f1c40f 72deg 144deg, #2ecc71 144deg 216deg,
    #3498db 216deg 288deg, #9b59b6 288deg 360deg);
}
.wheel-center {
  position: absolute; inset: 0; margin: auto; width: 3rem; height: 3rem;
  border-radius: 50%; background: #fff; border: 3px solid #c7ccd3;
}
.cooldown { margin-top: 0.6rem; color: var(--muted); }
.wheel-info { margin-top: 1rem; text-align: left; }
.wheel-info-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.wheel-info-label { color: var(--muted); }
.ok { color: #1a7f37; font-weight: 600; }
.unread { color: var(--err); }
.h-link { color: var(--acc); text-decoration: none; cursor: pointer; }
.h-link:hover { text-decoration: underline; }
.nearby-header { margin-bottom: 0.8rem; display: flex; gap: 0.4rem; }
.view-toggle { padding: 0.2rem 0.6rem; font-size: 0.9rem; border-radius: 4px; background: var(--line); border: 1px solid var(--line); cursor: pointer; }
.view-toggle.on { background: var(--acc); color: white; border-color: var(--acc); }
.gender-sel { padding: 0.2rem 0.4rem; font-size: 0.9rem; border-radius: 4px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.cooldown-active { color: var(--muted); }
.cooldown-ready { color: #1a7f37; font-weight: 600; }
.flash { color: #1a7f37; }
.profile-card { text-align: left; display: flex; flex-direction: column; gap: 0.75rem; }
.profile-card .avatar { width: 84px; height: 84px; font-size: 34px; flex-shrink: 0; }
.p-top { display: flex; gap: 1rem; align-items: center; }
.p-info h3 { margin: 0; font-size: 1.25rem; }
.p-pts { color: var(--acc); font-weight: 600; }
.p-status { background: #f3f5f9; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.8rem; white-space: pre-wrap; }
.p-photos { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.p-photo { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.p-fields { width: 100%; border-collapse: collapse; }
.p-fields th, .p-fields td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.p-fields th { color: var(--muted); font-weight: 600; white-space: nowrap; width: 40%; }
