:root {
  --bg: #101418;
  --card: #1a2027;
  --line: #2a323c;
  --text: #e8edf2;
  --muted: #94a1ae;
  --accent: #3fa66a;
  --error: #d96a5c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.15rem; font-weight: 650; letter-spacing: 0.01em; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.span2 { grid-column: 1 / -1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.card h2 { font-size: 1rem; margin-bottom: 6px; }

.placeholder {
  margin-top: 12px;
  padding: 6px 10px;
  display: inline-block;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--error); margin-top: 10px; }

button {
  background: var(--accent);
  color: #0c1210;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 0.85rem;
}

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card #step-email p, .login-card #step-code p { margin-bottom: 10px; }
.login-card #resend { margin-top: 10px; }
.inapp-warn {
  display: flex; flex-direction: column; gap: 8px;
  background: #33270f; border: 1px solid #b9862f; border-radius: 12px;
  padding: 12px 14px; font-size: 0.9rem;
}
.inapp-warn button { align-self: flex-start; }

.admin-details { border-top: 1px solid var(--line); padding-top: 12px; }
.admin-details summary { cursor: pointer; }
.admin-details form { margin-top: 10px; }

input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }

select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  font-size: 0.95rem;
}

.row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.row input:not([type="checkbox"]) { flex: 1; min-width: 140px; }

.small { font-size: 0.82rem; }
.big { font-size: 1.6rem; font-weight: 700; }
.inline-num { width: 80px; padding: 6px 8px; }

.banner { border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.error-banner { background: #3a1f1c; border: 1px solid var(--error); color: var(--text); }
.error-banner button {
  margin-left: 10px; background: var(--error); color: #fff; border: 0;
  border-radius: 8px; padding: 6px 14px; font-weight: 700;
}

.plain-list { list-style: none; margin: 8px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
button.danger { color: var(--error); border-color: var(--error); }
.card h3 { font-size: 0.9rem; margin-top: 6px; color: var(--muted); }

.card-summary {
  display: flex; align-items: baseline; gap: 10px; cursor: pointer;
  list-style: none;
}
.card-summary::before { content: '\25B8'; color: var(--muted); }
details[open] .card-summary::before { content: '\25BE'; }
details[open] .card-summary span { display: none; }
.card-summary h2 { display: inline; }

.corpus-item {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  display: flex; flex-direction: column; gap: 4px;
}
.corpus-item audio { max-width: 260px; }
.file-link { color: var(--accent); text-decoration: none; font-weight: 600; }

.ghost-link { color: var(--muted); font-size: 0.85rem; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }

#invite-result { margin-top: 10px; }
.invite-url {
  word-break: break-all; color: var(--accent);
  background: var(--bg); border: 1px dashed var(--line); border-radius: 10px;
  padding: 8px 10px; margin: 6px 0; font-size: 0.82rem;
  user-select: all; -webkit-user-select: all;
}

.checks { align-items: center; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 0.85rem;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; user-select: none;
}
.check:has(input:checked) { border-color: var(--accent); color: var(--text); }
.check input[type="checkbox"] {
  flex: none; width: 16px; height: 16px; margin: 0; padding: 0;
  accent-color: var(--accent);
}
.checks #invite-create { margin-left: auto; }
