:root {
  color-scheme: light dark;
  --ground: #f7f5f2;
  --ink: #1d1b19;
  --muted: #6b655e;
  --line: #ddd6cd;
  --accent: #7a3e2e;
  --alert: #b3261e;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #171514;
    --ink: #eeeae4;
    --muted: #a39c93;
    --line: #37322e;
    --accent: #e0a48f;
    --alert: #ff8a80;
  }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.1rem;
  margin: 2rem 0 0.75rem;
}

header p {
  margin: 0.1rem 0;
}

.muted {
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.toolbar p {
  margin: 0;
}

button {
  font: inherit;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

button:disabled {
  color: var(--muted);
  cursor: default;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.alert,
tr.unverified td {
  color: #b3261e;
}

@media (prefers-color-scheme: dark) {
  .alert,
  tr.unverified td {
    color: #ff8a80;
  }
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}

h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

nav button[aria-current="page"] {
  border-color: var(--accent);
  font-weight: 600;
}

input,
select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: transparent;
  color: var(--ink);
}

input[type="search"] {
  min-width: min(22rem, 100%);
}

#login {
  max-width: 22rem;
  padding-top: 4rem;
}

.login-form {
  display: grid;
  gap: 0.4rem;
  margin-top: 1.5rem;
}

.login-form label {
  font-weight: 600;
}

.login-form input {
  margin-bottom: 0.6rem;
}

.login-form button {
  justify-self: start;
}

caption {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 0.25rem 0;
}

.panel {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
}

.panel.private {
  border-top: 2px solid var(--accent);
}

.sublist {
  margin: 0.75rem 0 1rem;
}

.notice {
  color: var(--accent);
}

.block {
  display: block;
}

.facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.25rem 1rem;
  margin: 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-button {
  border: none;
  padding: 0 0.25rem;
}

.user-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

/* Member text: isolated, and clipped so stacked combining marks ("zalgo")
   cannot paint over neighbouring rows. */
.member-text {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem;
  max-width: 100%;
}

.member-value {
  display: inline-block;
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
  vertical-align: bottom;
  line-height: 1.45;
}

.phone-reveal input {
  min-width: min(20rem, 100%);
}

.revealed-phone {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  color: var(--muted);
  white-space: nowrap;
}

.badge-warning {
  border-color: #b26a00;
  color: #b26a00;
}

.badge-alert {
  border-color: #b3261e;
  color: #b3261e;
}

@media (prefers-color-scheme: dark) {
  .badge-warning {
    border-color: #ffb74d;
    color: #ffb74d;
  }

  .badge-alert {
    border-color: #ff8a80;
    color: #ff8a80;
  }
}

/* Phase D: enforcement, phone blocks, moderation queue */

.action-form {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.5rem 0.9rem 0.75rem;
  margin: 0.75rem 0;
}

.action-form.destructive {
  border-color: #b3261e;
}

.action-form label.block {
  margin: 0.4rem 0;
}

.reason-input {
  width: min(40rem, 100%);
}

button.danger {
  border-color: #b3261e;
  color: #b3261e;
}

.queue-event {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0;
}

.queue-event.at-risk {
  border-top: 2px solid #b3261e;
}

@media (prefers-color-scheme: dark) {
  .action-form.destructive,
  .queue-event.at-risk {
    border-color: #ff8a80;
  }

  button.danger {
    border-color: #ff8a80;
    color: #ff8a80;
  }
}

/* Graph views. Cytoscape draws onto canvases inside .graph-canvas; its own
   inline <style> is refused by the CSP, so the container is positioned here. */
.graph-canvas {
  position: relative;
  height: min(34rem, 70vh);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  margin: 0.75rem 0;
  overflow: hidden;
}

.graph-canvas[hidden] {
  display: none;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem;
}

.compare-card,
.signal {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.5rem 0.9rem 0.9rem;
  margin: 0.75rem 0;
}

.legend {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

details > summary {
  cursor: pointer;
  color: var(--accent);
  margin: 0.5rem 0;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0.75rem 0;
}

.chart-title {
  margin: 0 0 0.25rem;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-svg .bar {
  fill: var(--accent);
}

.chart-svg .bar-target {
  fill: transparent;
}

.chart-svg .bar-hit:hover .bar {
  fill: var(--ink);
}

.chart-svg .baseline {
  stroke: var(--muted);
  stroke-width: 1;
}

.chart-svg .grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.chart-svg .axis-label {
  fill: var(--muted);
  font-size: 10px;
}
