/* ==========================================================================
   TERMS & CONDITIONS  (#328)                              prefix: terms-
   --------------------------------------------------------------------------
   The admin register at #/terms, plus the citation line the two con-note
   sheets print. `terms-` was free in css/app.css, css/modules/, the portal
   stylesheet and driver/driver.css before this file existed (grepped, 0 hits)
   — worth keeping true, because the one-owner rule in tests/css-split-check.js
   means a selector appearing in two module files hands the tie to the
   alphabet.

   Everything else is borrowed on purpose: .card, .table, .btn, .section-title,
   .reg-err and .badge come from css/core.css, so this file holds only what is
   specific to a versioned legal record.

   TWO TREATMENTS THAT MUST NOT BE CONFUSED, and they are the reason this file
   is more than layout:

     .terms-unknown  HATCHED — "we do not know". A version whose wording this
                     system no longer holds, or a register it has not been able
                     to read yet. Never a flat colour, and never folded into
                     either a positive or a negative answer.
     .terms-none     DIMMED AND DASHED — "we know exactly, and there is nothing
                     to show". No version has ever been published (the OQ-19
                     state), or a quote went out before there was one. This is
                     a known negative and must NOT be hatched, which is the one
                     place it is easy to get backwards.
   ========================================================================== */

/* ---- the register ------------------------------------------------------- */
.terms-wrap { display:flex; flex-direction:column; gap:16px; }
.terms-tabs { display:flex; gap:6px; flex-wrap:wrap; }
.terms-tab {
  border:1px solid var(--line); background:#fff; border-radius:8px;
  padding:7px 13px; font-family:var(--font); font-weight:800; font-size:13px;
  color:var(--muted-2); cursor:pointer;
}
.terms-tab.is-on { background:var(--ink); color:#fff; border-color:var(--ink); }

.terms-grid { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); gap:16px; }
@media (max-width:1000px) { .terms-grid { grid-template-columns:minmax(0,1fr); } }

.terms-head { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin:0 0 10px; }
.terms-vnum { font-weight:900; font-size:20px; letter-spacing:-.4px; }
.terms-eff  { font-weight:700; font-size:12px; color:var(--muted); }
.terms-by   { font-weight:700; font-size:12px; color:var(--muted-2); }

/* The wording itself. `pre-wrap` because a clause is authored with its own line
   breaks and paragraphs, and collapsing them is how a legal document becomes
   one unreadable block — the same defect NF.Quotes.originalFor exists to undo
   for an email snippet. */
.terms-body {
  white-space:pre-wrap; font-family:var(--font); font-weight:600; font-size:13px;
  line-height:1.65; color:var(--ink); border:1px solid var(--line);
  border-radius:10px; padding:14px 16px; background:#fff; max-height:520px; overflow:auto;
}
.terms-note { font-weight:700; font-size:12px; color:var(--muted-2); margin:8px 0 0; line-height:1.5; }

.terms-link {
  display:inline-block; font-family:var(--mono,monospace); font-size:12px; font-weight:700;
  word-break:break-all; background:var(--bg-2,#f4f5f7); border:1px solid var(--line);
  border-radius:6px; padding:4px 8px; color:var(--ink); text-decoration:none;
}
.terms-link:hover { text-decoration:underline; }

/* ---- history ------------------------------------------------------------ */
.terms-hist { display:flex; flex-direction:column; gap:8px; }
.terms-row {
  border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:#fff;
  display:flex; flex-direction:column; gap:6px;
}
.terms-row.is-current { border-color:var(--ink); box-shadow:inset 3px 0 0 var(--ink); }
.terms-rowtop { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.terms-excerpt {
  font-weight:600; font-size:12px; color:var(--muted-2); line-height:1.5;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}

/* ---- the editor -------------------------------------------------------- */
.terms-editor { display:flex; flex-direction:column; gap:10px; }
.terms-editor textarea {
  width:100%; min-height:260px; box-sizing:border-box; padding:12px 14px;
  border:1px solid var(--line); border-radius:10px; font-family:var(--font);
  font-weight:600; font-size:13px; line-height:1.6; resize:vertical;
}
.terms-fields { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; }
.terms-field { display:flex; flex-direction:column; gap:4px; }
.terms-field > span { font-weight:800; font-size:11px; text-transform:uppercase;
  letter-spacing:.4px; color:var(--muted); }
.terms-field input {
  padding:8px 10px; border:1px solid var(--line); border-radius:8px;
  font-family:var(--font); font-weight:700; font-size:13px;
}

/* ---- the gate note ----------------------------------------------------- */
/* Publishing is gated. Until `seniorManager` / `terms.publish` exist in
   js/data.js this screen gates on the administrator action that DOES exist, and
   says so on the screen rather than in a comment — a gate that is not the
   intended one, described as though it were, is worse than no gate. */
.terms-gate {
  border:1px solid var(--line); border-left:4px solid var(--warn,#c98a00);
  border-radius:8px; padding:10px 12px; background:var(--bg-2,#f4f5f7);
  font-weight:700; font-size:12px; line-height:1.55; color:var(--muted-2);
}

/* ---- THE TWO STATES THAT ARE NOT VALUES ------------------------------- */
/* HATCHED = we do not know. */
.terms-unknown {
  border:1px dashed var(--line); border-radius:10px; padding:14px 16px;
  font-weight:700; font-size:13px; line-height:1.6; color:var(--muted-2);
  background-image:repeating-linear-gradient(135deg,
    rgba(0,0,0,.055) 0 6px, transparent 6px 12px);
}
/* DIMMED AND DASHED = we know, and there is deliberately nothing. */
.terms-none {
  border:1px dashed var(--line); border-radius:10px; padding:14px 16px;
  font-weight:700; font-size:13px; line-height:1.6; color:var(--muted);
  background:#fff;
}
.terms-none b, .terms-unknown b { color:var(--ink); }

/* ---- the citation on a con note --------------------------------------- */
/* Printed paperwork, so this is text weight and a URL in full rather than a
   control: nobody clicks a piece of paper. */
.terms-cite { font-weight:600; }
.terms-cite-url { font-family:var(--mono,monospace); font-size:11px; word-break:break-all; }
.terms-cite--unrec { color:var(--muted); font-style:italic; }
