/* The legal pack (session L): /terms, /privacy, /cookies, /terms-of-business,
   /data-sharing and /portal-terms. One stylesheet for six pages, because they
   are one document set and should change together. The layout is /mua's one
   column (mua.html), the numbered clauses /kyc's (kyc.html), copied here once
   rather than into six <style> blocks.

   They are drafts for legal review, so the banner and the placeholders are
   part of the design: tinted on screen, bordered on paper, never mistaken for
   settled text. Tables scroll inside their box on a phone, as on /kyc,
   instead of /mua's stacked cells, whose labels would sit in CSS content:
   where the French overlay cannot reach them. */

body { background: var(--bg); }

.doc-page { max-width: 880px; margin: 0 auto; padding: 26px 20px 90px; }

/* ---- The bar: logo home, the set's name, language, print ---- */
.doc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.doc-bar .doc-logo { display: inline-flex; }
.doc-bar img { width: 116px; height: auto; }
.doc-bar .crumb { font-size: 0.84rem; color: var(--muted); margin-right: auto; }
.print-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-3);
  border-radius: 999px;
  padding: 7px 14px;
  font: 500 0.84rem var(--font-body);
  cursor: pointer;
}
.print-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ---- The draft banner: first thing read, on screen and on paper ---- */
.doc-draft {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin: 0 0 clamp(26px, 5vw, 40px);
  padding: 11px 16px;
  border: 1px dashed var(--warn-border);
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}
.doc-draft time { font-weight: 500; color: var(--muted); }

/* ---- Title block ---- */
.title-block { margin-bottom: clamp(28px, 5vw, 42px); }
.title-block .kicker {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 14px;
}
.title-block h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -0.035em; margin-bottom: 0.4em; }
.title-block p { color: var(--muted); font-size: clamp(1rem, 2vw, 1.12rem); max-width: 62ch; margin: 0; }

.control {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.control div { padding: 13px 18px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; min-width: 0; }
.control dt { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 3px; }
.control dd { margin: 0; font-size: 0.92rem; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.control dd.draft { color: var(--brand); }

/* ---- Contents: one column of the page, not /kyc's sidebar ---- */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 12px;
  margin: 0 0 clamp(30px, 5vw, 44px);
}
.toc b { display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.toc ol { display: grid; gap: 2px 24px; counter-reset: toc; }
@media (min-width: 640px) { .toc ol { grid-template-columns: 1fr 1fr; } }
.toc li { counter-increment: toc; min-width: 0; }
.toc a {
  display: flex;
  gap: 10px;
  padding: 5px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--ink-3);
  text-decoration: none;
  line-height: 1.35;
}
.toc a::before { content: counter(toc); flex: none; width: 18px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.toc a:hover { background: var(--brand-tint); color: var(--brand); }

/* ---- Sections, numbered by the page ---- */
.body { counter-reset: sec; }
.sec { padding-block: 0; margin-bottom: clamp(36px, 5vw, 50px); scroll-margin-top: 20px; counter-increment: sec; }
.sec > h2 {
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  letter-spacing: -0.025em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.sec > h2::before {
  content: counter(sec);
  flex: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
}
/* Schedules and signature blocks follow the numbered clauses unnumbered. */
.sec.unnumbered { counter-increment: none; }
.sec.unnumbered > h2::before { content: none; }
.sec h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.sec p, .sec li { color: var(--ink-3); font-size: 0.98rem; }
.sec p { margin: 0 0 12px; max-width: 70ch; }
.sec a { color: var(--brand); }

/* Contractual text: /kyc's clauses, numbered by data-n ("3.2"), which the
   French overlay leaves alone because it is a number, not a word. */
.clauses { display: grid; gap: 10px; margin: 0 0 12px; }
.clauses > li { position: relative; padding-left: 42px; }
.clauses > li::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.clauses .bullets { margin-top: 8px; }

.bullets { display: grid; gap: 7px; margin: 0 0 12px; }
.bullets li { position: relative; padding-left: 18px; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--periwinkle); }

/* min-width: 0 on the wrap and the table's own min-width: the table scrolls
   inside its box on a phone, the page never does. */
.tbl-wrap { overflow-x: auto; margin: 6px 0 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
table.ref { width: 100%; border-collapse: collapse; min-width: 560px; font-size: 0.9rem; }
table.ref th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--brand-tint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
table.ref td { vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--ink-3); }
table.ref tr:last-child td { border-bottom: 0; }
table.ref td:first-child { font-weight: 600; color: var(--ink); }

.callout {
  border-left: 3px solid var(--brand);
  background: var(--brand-tint);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 18px;
  margin: 8px 0 14px;
  font-size: 0.95rem;
  color: var(--ink-3);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--mist);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
/* A key name in a table's Name cell is whole or it is wrong: "anywhere"
   lets the table shrink that column until tego_session reads "tego_sess /
   ion". On a phone the table scrolls in its box instead. */
table.ref td code { overflow-wrap: normal; white-space: nowrap; }

/* ---- Placeholders: what a lawyer or a founder still has to write ---- */
.tbc {
  background: var(--warn-bg);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink);
  font-style: italic;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
/* A line to write on, in the data-sharing template. */
.blank { display: inline-block; min-width: 14em; max-width: 100%; height: 1.1em; border-bottom: 1px solid var(--ink-3); vertical-align: bottom; }
.sig-blocks { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 10px 0 0; }
.sig-blocks > div { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; min-width: 0; }
.sig-blocks dl { display: grid; gap: 10px; margin: 8px 0 0; }
.sig-blocks dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); }
.sig-blocks dd { margin: 2px 0 0; }

/* ---- Bottom: status, company, the rest of the set ---- */
.signoff {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 28px;
  margin-top: 8px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 0.93rem;
  color: var(--muted);
}
.signoff > span { min-width: 0; max-width: 46ch; }
.signoff b { display: block; color: var(--ink); font-size: 1.02rem; font-weight: 600; }
.footnote { margin-top: 22px; font-size: 0.8rem; color: var(--muted-2); max-width: 70ch; }
.doc-others { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 0.86rem; }
.doc-others b { width: 100%; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.doc-others a { color: var(--brand); }

/* ---- Paper: printed or saved as PDF, A4, as /mua ---- */
@media print {
  @page { size: A4 portrait; margin: 15mm; }
  /* Every size above is in rem, so this one line takes body text from about
     12pt to about 9.5pt. */
  html { font-size: 12.5px; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-page { max-width: none; padding: 0; }
  .doc-bar { padding-bottom: 10px; margin-bottom: 12px; }
  .doc-bar img { width: 92px; }
  .doc-bar .print-btn, .doc-bar .lang-toggle, .toc { display: none; }
  .doc-draft { margin-bottom: 16px; padding: 7px 12px; border-style: solid; }
  .title-block { margin-bottom: 18px; }
  .title-block h1 { font-size: 2.3rem; }
  .control { margin-top: 14px; grid-template-columns: repeat(4, 1fr); }
  .control div { padding: 8px 12px; }
  .sec { margin-bottom: 18px; }
  .sec > h2 { font-size: 1.45rem; padding-bottom: 7px; margin-bottom: 10px; }
  .sec h3 { margin: 14px 0 6px; }
  .sec p { margin-bottom: 8px; }
  .tbl-wrap { overflow: visible; margin: 4px 0 10px; }
  table.ref { min-width: 0; }
  table.ref th, table.ref td { padding: 6px 10px; }
  .tbc { background: none; border: 1px solid var(--ink-3); }
  .callout, .signoff { padding: 10px 14px; }
  .sec > h2, .sec h3 { break-after: avoid; }
  table.ref tr, .clauses > li, .bullets li, .callout, .signoff, .sig-blocks > div { break-inside: avoid; }
  a { text-decoration: none; }
}

/* ---- P6: the accept block on /portal-terms (js/terms-accept.js) ----
   Drawn before the sign-off for a signed-in insurer or partner login sent
   here with ?accept= (worker.js homeFor): the address and the version, the
   tick and Accept and continue, or the day it accepted and the way back. A
   panel in the brand's tint, so it reads as the page's one question rather
   than one more clause. On paper it is gone, and so is the cue below: the
   terms print as L wrote them. */
.terms-accept {
  display: grid;
  gap: 14px;
  justify-items: start;
  margin: 8px 0 18px;
  padding: 20px 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--brand-tint);
}
.terms-accept p { margin: 0; max-width: 70ch; color: var(--ink); overflow-wrap: anywhere; }
.terms-accept .field-error { margin: 0; color: var(--error); }
.terms-accept-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
/* While the terms are due, the script also draws one line under the
   control block, a callout like the clauses' own: who is signed in, and a
   link down to the block, which the first screen would not otherwise show.
   The title block's paragraph rule would make it muted and margin-less. */
.title-block .terms-cue { margin: 18px 0 0; max-width: none; font-size: 0.95rem; color: var(--ink); overflow-wrap: anywhere; }
.terms-cue a { color: var(--brand); font-weight: 600; }
#terms-accept { scroll-margin-top: 20px; }
@media print {
  #terms-accept, .terms-cue { display: none; }
}
