/* Postpartum+ Trust & Safety: the report form, the Safety Center, the
   legal forms, the Community Bot and the moderation dashboard. Uses the
   tokens from app.css and calm.css, so night mode follows. */

/* ---------- Shared ---------------------------------------------------- */
:root {
  /* The one data color in the metrics bars: validated for contrast and
     chroma against the light surface (and its night step below). */
  --mod-bar: #c3664c;
}
html[data-night] {
  --mod-bar: #d4745a;
}
.tag.sev-critical,
.tag.sev-high {
  background: var(--danger-soft);
  color: var(--danger);
}
.tag.sev-medium {
  background: var(--gold-soft);
  color: #7a5a1e;
}
html[data-night] .tag.sev-medium {
  color: #e2c27d;
}
.tag.sev-low,
.tag.sev-none {
  background: transparent;
  border: 1px solid var(--line);
}

/* ---------- Report form and context notes ----------------------------- */
.report-help p {
  margin: 0 0 6px;
}
.report-help .link-btn {
  font-size: 0.9rem;
}
.context-note {
  margin: 8px 0 4px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--sky-soft);
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.45;
}
.context-note a {
  white-space: nowrap;
}
/* On a phone a post is a grid (design.css, D3): the note spans the whole
   row above the votes and actions instead of widening the votes column. */
@media (max-width: 700px) {
  .post .context-note {
    grid-column: 1 / -1;
  }
}

/* ---------- Before joining the conversation --------------------------- */
.join-rules {
  margin: 0 0 8px;
  padding-left: 1.2em;
}
.join-rules li {
  margin: 4px 0;
}
fieldset.dob {
  border: 0;
  padding: 0;
  margin: 8px 0 0;
}
fieldset.dob legend {
  font-weight: 600;
  margin-bottom: 6px;
}
.form-row.three {
  grid-template-columns: 1.4fr 1fr 1.1fr;
}

/* ---------- Safety Center --------------------------------------------- */
.safety-status {
  margin-bottom: 22px;
}
.safety-h {
  font-size: 1.2rem;
  margin: 26px 0 10px;
}
.safety-list {
  display: grid;
  gap: 12px;
}
.safety-item h3 {
  font-size: 1.05rem;
  margin: 0;
}
.safety-item.unread {
  box-shadow: inset 3px 0 0 var(--accent);
}
.safety-excerpt {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.92rem;
}
.safety-reports {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.safety-reports li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.safety-help {
  margin-top: 28px;
}
.safety-help h3 {
  font-size: 1.05rem;
}

/* ---------- Community Bot --------------------------------------------- */
.bot-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bot-row input {
  flex: 1;
  min-width: 0;
}
.bot-answer {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
}
.bot-answer p {
  margin: 0;
}
.bot-suggest {
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ---------- Legal forms ----------------------------------------------- */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: start;
}
.legal-layout .prose > :first-child {
  margin-top: 0;
}
.legal-check {
  align-items: flex-start;
  line-height: 1.45;
}
.legal-check input {
  margin-top: 3px;
  flex: none;
}
@media (max-width: 860px) {
  .legal-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Moderation dashboard -------------------------------------- */
.mod-layout .account-nav button {
  justify-content: space-between;
}
.mod-body {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}
.mod-body > .btn {
  justify-self: start;
}
.mod-list {
  display: grid;
  gap: 10px;
}
.mod-row {
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
}
.mod-row:hover,
.mod-row:focus-visible {
  border-color: var(--line-strong);
}
.mod-row-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mod-row-excerpt {
  color: var(--ink-2);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.mod-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.mod-grid > div {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.mod-grid h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}
.mod-actions h4 {
  font-size: 0.9rem;
  margin: 14px 0 6px;
  color: var(--muted);
}
.mod-buttons {
  flex-wrap: wrap;
  gap: 6px;
}
.mod-content {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--paper-2);
  overflow-wrap: anywhere;
}
.mod-content p:last-child {
  margin-bottom: 0;
}
.mod-reports,
.mod-history {
  margin: 0;
  padding-left: 1.1em;
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
}
.mod-screen {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.mod-screen:last-of-type {
  border-bottom: 0;
}
.mod-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 8px 0;
  font-size: 0.92rem;
}
.mod-dl dt {
  color: var(--muted);
}
.mod-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.mod-url {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}
.mod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.mod-table th,
.mod-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.mod-table td:last-child,
.mod-table th:last-child {
  font-variant-numeric: tabular-nums;
}

/* Stat tiles: label, value, optional note. */
.mod-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.mod-tile {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.mod-tile-label {
  font-size: 0.84rem;
  color: var(--muted);
}
.mod-tile-value {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
}

/* Ranked bars: one series, one color, thin marks, value at the tip. */
.mod-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.mod-bars li {
  display: grid;
  grid-template-columns: minmax(90px, 12em) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}
.mod-bar-label {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.mod-bar-track {
  display: block;
  height: 12px;
}
.mod-bar {
  display: block;
  height: 12px;
  background: var(--mod-bar);
  border-radius: 0 4px 4px 0;
}
.mod-bar-value {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.mod-table-view {
  margin-top: 12px;
  font-size: 0.9rem;
}
.mod-table-view summary {
  cursor: pointer;
  color: var(--muted);
}
@media (max-width: 900px) {
  .mod-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .mod-bars li {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .mod-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .form-row.three {
    grid-template-columns: 1fr 1fr;
  }
}
@media (forced-colors: active) {
  .mod-bar {
    background: CanvasText;
  }
}
