/* Altself — minimal dark design system */
:root {
  --bg: #0b0b0d;
  --surface: #131316;
  --surface-2: #1a1a1f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ededef;
  --muted: #86868e;
  --accent: #5e6ad2;
  --accent-hover: #6e7ae2;
  --ok: #3fb68b;
  --warn: #d2a85e;
  --danger: #e5534b;
  --radius: 12px;
  font-size: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.screen { height: 100dvh; display: flex; flex-direction: column; }

/* ---------- auth ---------- */
#auth-screen { align-items: center; justify-content: center; }
.auth-card {
  width: min(380px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 30px;
  display: flex; flex-direction: column; gap: 14px;
}
.logo { font-weight: 700; font-size: 1.9rem; letter-spacing: -0.03em; }
.logo span { color: var(--muted); font-weight: 400; }
.logo.small { font-size: 1rem; }
.tagline { color: var(--muted); margin-top: -8px; font-size: .95rem; }
#auth-tabs { display: flex; gap: 6px; margin-top: 10px; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .9rem;
}
.auth-tab.active { background: var(--bg); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
input, textarea, select {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; color: var(--text); font-size: .95rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
::placeholder { color: #5c5c64; }
.modes { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .88rem; padding: 4px 2px; }
.modes label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.btn {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 18px;
  font-size: .95rem; font-weight: 600; cursor: pointer; font-family: inherit;
  background: var(--surface-2); color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--border-strong); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.round { border-radius: 10px; width: 42px; height: 42px; padding: 0; flex-shrink: 0; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.ok { background: transparent; border-color: var(--ok); color: var(--ok); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .88rem; font-family: inherit; }
.link-btn:hover { color: var(--text); }
.link-btn.danger { color: var(--danger); }
.error { color: var(--danger); font-size: .88rem; min-height: 1.2em; }

/* ---------- main layout ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
#verify-badge { font-size: .8rem; color: var(--warn); }
#verify-badge.ok { color: var(--ok); }
#tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; padding: 13px; background: none; border: none;
  color: var(--muted); font-size: .95rem; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; position: relative; font-family: inherit;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.dot {
  position: absolute; top: 10px; margin-left: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block;
}
.view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#main-screen { height: 100dvh; }

/* ---------- chat ---------- */
.chat-log {
  flex: 1; overflow-y: auto; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.bubble {
  max-width: 76%; padding: 10px 14px; border-radius: 16px;
  line-height: 1.45; white-space: pre-wrap; word-break: break-word;
  font-size: .95rem;
}
.bubble.ai {
  background: var(--surface-2); border: 1px solid var(--border);
  align-self: flex-start; border-bottom-left-radius: 5px;
}
.bubble.user {
  background: var(--accent); color: #fff;
  align-self: flex-end; border-bottom-right-radius: 5px;
}
.bubble img { max-width: 220px; border-radius: 10px; display: block; margin-top: 6px; }
.composer {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}
.composer input[type="text"], .composer input:not([type]) { flex: 1; }
.attach { font-size: 1.25rem; cursor: pointer; padding: 4px; opacity: .75; }
.attach:hover { opacity: 1; }

/* ---------- matches ---------- */
#matches-list { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.match-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.match-card .mode-tag { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.match-card h3 { font-size: 1.15rem; font-weight: 600; }
.match-card .pitch {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; line-height: 1.45; font-size: .92rem;
}
.match-photos { display: flex; gap: 8px; overflow-x: auto; }
.match-photos img { height: 140px; border-radius: 10px; }
.decision-row { display: flex; gap: 10px; }
.decision-row .btn { flex: 1; }
.empty { color: var(--muted); text-align: center; margin-top: 48px; line-height: 1.7; font-size: .95rem; }

/* ---------- pair overlay ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; z-index: 50;
}
.pair-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600;
}

/* ---------- admin ---------- */
.admin-wrap { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.admin-main { flex: 1; display: flex; overflow: hidden; }
.admin-list {
  width: 340px; min-width: 280px; overflow-y: auto;
  border-right: 1px solid var(--border); padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.admin-detail { flex: 1; overflow-y: auto; padding: 22px; }
.row-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.row-card:hover { border-color: var(--border-strong); }
.row-card.selected { border-color: var(--accent); }
.row-card .sub { color: var(--muted); font-size: .82rem; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: .72rem; font-weight: 600; border: 1px solid;
}
.badge.new { color: var(--accent-hover); border-color: var(--accent); background: transparent; }
.badge.pending { color: var(--warn); border-color: var(--warn); background: transparent; }
.badge.verified { color: var(--ok); border-color: var(--ok); background: transparent; }
.badge.banned { color: var(--danger); border-color: var(--danger); background: transparent; }
.badge.pitched { color: var(--accent-hover); border-color: var(--accent); background: transparent; }
.badge.active { color: var(--ok); border-color: var(--ok); background: transparent; }
.badge.declined, .badge.closed { color: var(--muted); border-color: var(--border-strong); background: transparent; }
.section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.section h3 { margin-bottom: 12px; font-size: .92rem; color: var(--text); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact-row { display: grid; grid-template-columns: 1.2fr 1.5fr 1.5fr .6fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.fact-row input { padding: 8px; font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.transcript {
  max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.admin-photos { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-photos figure { text-align: center; font-size: .75rem; color: var(--muted); }
.admin-photos img { height: 120px; border-radius: 8px; display: block; margin-bottom: 4px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.pill-tabs { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.pill {
  padding: 7px 15px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--muted); font-weight: 600; font-size: .88rem; font-family: inherit;
}
.pill:hover { color: var(--text); }
.pill.active { background: var(--surface-2); border-color: var(--border); color: var(--text); }
textarea { width: 100%; min-height: 80px; resize: vertical; }
.muted { color: var(--muted); font-size: .85rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.memory-row {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: .88rem;
}
.memory-row .kind { color: var(--accent-hover); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0; width: 80px; }
.memory-row .mtext { flex: 1; }
.icon { vertical-align: -2px; flex-shrink: 0; }

/* ---------- messenger ---------- */
.messenger { display: flex; height: 100dvh; }
.chat-list-pane { width: 340px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.thread-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pane-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; min-height: 62px; border-bottom: 1px solid var(--border);
}
.thread-header .chat-title { flex: 1; min-width: 0; }
.chat-list { flex: 1; overflow-y: auto; }
.chat-row {
  display: flex; gap: 12px; width: 100%; padding: 12px 16px; align-items: center;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.chat-row:hover { background: var(--surface); }
.chat-row.selected { background: var(--surface-2); }
.chat-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-row-top, .chat-row-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-row-top .muted { font-size: .75rem; flex-shrink: 0; }
.preview { color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread {
  background: var(--accent); color: #fff; border-radius: 99px; flex-shrink: 0;
  font-size: .72rem; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center;
}
.back-btn { display: none; align-items: center; padding: 4px; margin-left: -6px; }
.small-btn { padding: 6px 12px; font-size: .82rem; }
.bubble.mediator {
  align-self: center; max-width: 88%; font-size: .9rem;
  background: transparent; border: 1px dashed var(--accent);
}
.mediator-label {
  display: block; font-size: .7rem; color: var(--accent-hover); margin-bottom: 3px;
  text-transform: uppercase; letter-spacing: .06em;
}
.intro-card {
  align-self: flex-start; width: min(340px, 85%);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.intro-head { display: flex; gap: 10px; align-items: center; }
.intro-head .muted { display: block; font-size: .78rem; }
.intro-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.intro-actions .btn { padding: 8px 14px; font-size: .88rem; }
@media (max-width: 759px) {
  .chat-list-pane { width: 100%; border-right: none; }
  .messenger.show-list .thread-pane { display: none; }
  .messenger.show-thread .chat-list-pane { display: none; }
  .back-btn { display: inline-flex; }
}
.chat-title { display: flex; align-items: center; gap: 10px; }
.chat-title b { display: block; font-size: .95rem; font-weight: 600; }
.chat-title .muted { font-size: .75rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center;
  background: #2c2c36; color: var(--text); font-weight: 700; font-size: 1rem;
}
.avatar.alt { background: var(--accent); color: #fff; }
.badge.await_a, .badge.await_b { color: var(--warn); border-color: var(--warn); background: transparent; }
.topbar-links { display: flex; gap: 14px; align-items: center; }
.topbar-links a { text-decoration: none; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: .8rem; color: var(--muted); line-height: 1.45; cursor: pointer; }
.consent input { margin-top: 3px; }
.consent a, .legal a { color: var(--accent-hover); }
.pending-icon { color: var(--warn); margin-top: 6px; }
#pending-screen { align-items: center; justify-content: center; }
#pending-screen h2 { font-size: 1.2rem; font-weight: 600; }
.request-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 14px 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: .9rem; color: var(--muted);
}
.request-banner .grow { flex: 1; }
.request-banner .btn { padding: 7px 12px; font-size: .85rem; }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.action-row { font-size: .82rem; padding: 7px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 70px 130px 1fr; gap: 8px; }
.action-row .tool { color: var(--accent-hover); font-weight: 600; }
.action-row .args { color: var(--muted); word-break: break-word; }
.action-row.error .tool { color: var(--danger); }
.sev-high { color: var(--danger); font-weight: 600; }
.sev-medium { color: var(--warn); font-weight: 600; }
.sev-low { color: var(--muted); }
button .icon, h3 .icon, .pill .icon { margin-right: 2px; opacity: .85; }
.attach .icon { width: 20px; height: 20px; }
@media (max-width: 720px) {
  .admin-main { flex-direction: column; }
  .admin-list { width: 100%; max-height: 40dvh; border-right: none; border-bottom: 1px solid var(--border); }
  .fact-row { grid-template-columns: 1fr 1fr; }
}
