/* ===========================================================================
   Data Tomo — rating an answer, and the admin triage queue (LTA-134)
   ===========================================================================

   Loaded after data-tomo.css, whose :root tokens this file reads. Two
   surfaces, one file, because they are one feature: `.dt-rate-*` is the
   control at the FOOT of the answer card, `.dt-fb-*` is the queue an admin
   triages the ratings in.

   NAMING. Every class defined here carries the `dt-` prefix, with no
   exceptions — app.css is 4,400+ lines of unprefixed class names and the
   prototype already lost an afternoon to a cascade collision (see
   data-tomo.css's header). The Review nav dropdown this feature adds is NOT
   here: it lives in users.css beside `.acct-*`, which is the same kind of nav
   menu and the file that already owns the nav.

   No external asset of any kind, deliberately. nginx sends a CSP and uvicorn
   does not, so a font or image from an un-allowed origin fails silently on
   every deployed environment and nowhere locally (LTA-103).
   ========================================================================= */

/* --- The control on the card --------------------------------------------- */

.dt-rate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 20px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--dt-border-light);
}

.dt-rate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex-basis: 100%;
}

.dt-rate-l { font-size: 0.8rem; color: var(--dt-text-muted); }

.dt-rate-b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ab-surface, #fff);
  border: 1px solid var(--dt-border);
  border-radius: 7px;
  padding: 0.3rem 0.7rem;
  font-family: var(--ab-font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dt-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.dt-rate-b:hover {
  border-color: var(--dt-accent);
  color: var(--dt-accent);
  background: var(--dt-accent-soft);
}

/* aria-pressed is the state, not a class: the attribute is what a screen
   reader announces, so styling off anything else would let the two disagree. */
.dt-rate-b[aria-pressed="true"] {
  background: var(--dt-accent);
  border-color: var(--dt-accent);
  color: #fff;
}

.dt-rate-down:hover { border-color: #9b2c2c; color: #9b2c2c; background: #fbeaea; }
.dt-rate-down[aria-pressed="true"] { background: #9b2c2c; border-color: #9b2c2c; }
.dt-rate-b[aria-pressed="true"]:hover { color: #fff; }

.dt-rate-ok {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ab-success, #2f7a55);
}

/* The consent line. Visible BEFORE the first click, never as a confirmation
   after it — somebody who has already pressed Yes cannot un-know what
   pressing it did. */
.dt-rate-why {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--dt-text-muted);
  max-width: 62ch;
}

.dt-rate-ask {
  flex-basis: 100%;
  margin: 4px 0 0;
  padding: 12px 14px;
  background: var(--ab-bg, #f9faf9);
  border: 1px solid var(--dt-border);
  border-radius: 8px;
}

/* The HTML `hidden` attribute must win over the flex display above it. */
.dt-rate-ask[hidden], .dt-rate-note[hidden] { display: none !important; }

.dt-rate-q {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dt-text-head);
}

.dt-rate-opts { display: flex; flex-direction: column; gap: 2px; }

.dt-rate-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--dt-text-body);
  cursor: pointer;
}

.dt-rate-opt:hover { background: var(--dt-hover-bg); }
.dt-rate-opt input { margin: 3px 0 0; flex: none; accent-color: var(--dt-accent); }
.dt-rate-opt-on { color: var(--dt-text-head); font-weight: 600; }

.dt-rate-note { flex-basis: 100%; display: flex; gap: 10px; }

.dt-rate-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--ab-font-body);
  font-size: 0.8rem;
  line-height: 1.45;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--dt-border);
  border-radius: 7px;
  resize: vertical;
}

.dt-rate-text:focus { outline: none; border-color: var(--dt-accent); }

.dt-rate-err {
  flex-basis: 100%;
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #9b2c2c;
}

/* --- The queue ----------------------------------------------------------- */

.dt-fb-page { padding-bottom: 2rem; }

.dt-fb-sum { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

.dt-fb-stat {
  background: var(--ab-surface, #fff);
  border: 1px solid var(--dt-border);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 118px;
}

.dt-fb-n {
  display: block;
  font-family: var(--dt-font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--dt-text-head);
}

.dt-fb-sl { font-size: 0.72rem; color: var(--dt-text-muted); }
.dt-fb-stat-bad .dt-fb-n { color: #9b2c2c; }
.dt-fb-stat-good .dt-fb-n { color: var(--ab-success, #2f7a55); }

.dt-fb-card {
  background: var(--ab-surface, #fff);
  border: 1px solid var(--dt-border);
  border-left: 3px solid var(--dt-border);
  border-radius: var(--dt-radius);
  box-shadow: var(--dt-shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.dt-fb-down { border-left-color: #9b2c2c; }
.dt-fb-up { border-left-color: var(--ab-success, #2f7a55); }

.dt-fb-h {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--dt-card-head);
  border-bottom: 1px solid var(--dt-border-light);
}

.dt-fb-v {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.dt-fb-v-down { background: #fbeaea; color: #9b2c2c; }
.dt-fb-v-up { background: #e5f1ea; color: var(--ab-success, #2f7a55); }

.dt-fb-who { font-size: 0.8rem; color: var(--dt-text-muted); }
.dt-fb-who b { color: var(--dt-text-body); font-weight: 600; }
.dt-fb-when {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--dt-text-muted);
  white-space: nowrap;
}

.dt-fb-b { padding: 16px 18px; }

.dt-fb-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }

.dt-fb-tag {
  font-size: 0.72rem;
  font-weight: 600;
  background: #fbeaea;
  color: #9b2c2c;
  padding: 3px 9px;
  border-radius: 6px;
}

.dt-fb-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #fbf0dd;
  border: 1px solid #f0dcb4;
  border-radius: 7px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--dt-text-body);
}

.dt-fb-note-none {
  background: var(--ab-bg, #f9faf9);
  border: 1px dashed var(--dt-border);
  color: var(--dt-text-muted);
  font-style: italic;
}

.dt-fb-qa {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px 16px;
  align-items: start;
  margin: 0;
}

.dt-fb-qa dt {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dt-text-muted);
  padding-top: 3px;
}

.dt-fb-qa dd {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--dt-text-body);
  overflow-wrap: anywhere;
}

.dt-fb-q { color: var(--dt-text-head); font-weight: 600; }

.dt-fb-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.dt-fb-slug {
  font-family: var(--dt-font-mono);
  font-size: 0.7rem;
  color: var(--dt-accent);
  background: var(--dt-accent-soft);
  padding: 2px 7px;
  border-radius: 5px;
}

/* The one thing on this page that only exists because of the snapshot: the
   rating outlived its conversation, so there is nothing to open. */
.dt-fb-orphan {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 14px 0 0;
  padding: 10px 14px;
  background: #eef4f8;
  border: 1px solid #d6e3ec;
  border-radius: 7px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #2b4a5e;
}

.dt-fb-orphan b { font-weight: 600; }

.dt-fb-acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--dt-border-light);
  background: var(--dt-card-head);
}

.dt-fb-open {
  background: var(--ab-surface, #fff);
  border: 1px solid var(--dt-border);
  border-radius: 7px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dt-text-body);
  text-decoration: none;
  white-space: nowrap;
}

.dt-fb-open:hover {
  border-color: var(--dt-accent);
  color: var(--dt-accent);
  background: var(--dt-accent-soft);
}

.dt-fb-del {
  background: none;
  border: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-family: var(--ab-font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dt-text-muted);
  cursor: pointer;
}

.dt-fb-del:hover { color: #9b2c2c; background: #fbeaea; }

.dt-fb-sp {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--dt-text-muted);
  text-align: right;
  max-width: 34ch;
}

.dt-fb-none, .dt-fb-foot {
  margin: 18px 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--dt-text-muted);
  max-width: 72ch;
}

.dt-fb-err { margin: 12px 0 0; font-size: 0.8rem; color: #9b2c2c; }

/* The queue is paged: one window per request, because the table only grows. */
.dt-fb-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
}

.dt-fb-morebtn {
  background: var(--ab-surface, #fff);
  border: 1px solid var(--dt-border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-family: var(--ab-font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dt-text);
  cursor: pointer;
}

.dt-fb-morebtn:hover:not([disabled]) {
  background: var(--dt-accent-soft);
  border-color: var(--dt-accent);
}

.dt-fb-morebtn[disabled] { opacity: 0.6; cursor: default; }

@media (max-width: 720px) {
  .dt-fb-qa { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dt-fb-qa dt { padding-top: 10px; }
  .dt-fb-when, .dt-fb-sp { margin-left: 0; text-align: left; }
}
