/* claims: Claims, a claim, Invoices and an invoice (DIRECTION-v6.md 6.3, over DIRECTION-v4.md 4.15 to
   4.18). There is no invoices.css; the invoice pages live here too. Shared parts come from styles.css:
   .box and its .edged and .wash hovers (3.1, 3.3), the icon tiles (3.4), the stat tiles (3.2), the task
   panel and its version 5 hero (3.8), info boxes and empty states (3.17). The thread and reply box are
   messages.css's; the draft row inside .clm-draft is claimflow.css's. Motion reads motion.css's tokens
   (--dur-*, --ease-*, --mo-k) and motion.js's html.mo-enter, with fallbacks, and does nothing under html.mo-still
   (reduced motion, or "Motion: off"). */

/* ---------- Claims (4.15, 6.3) ---------- */
/* A saved draft (claimflow.js's row) sits first, the open claims under it */
.clm-draft + .boxes { margin-top: var(--gap-cards); }

/* An open claim: a container with the tracker, the title its stretched link (.box.edged: the green
   edge on hover, the title underlines). A lime tile with the clock while the note is missing, else
   the claim's icon on mint; the lime chip only while it waits for her. The tile sits beside the title
   and meta; the rest lines up under the title */
.claim-box { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 20px; align-items: start; }
.claim-box > .it { grid-row: 1 / span 2; align-self: center; }
.claim-box > h3 { grid-column: 2; font-size: var(--fs-section); line-height: var(--lh-section); }
.claim-box > .meta { grid-column: 2; margin-top: 2px; color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); }
.claim-box > .cb-chip { grid-column: 2; margin-top: var(--s-4); }
.claim-box > .cb-track { grid-column: 2; }
.claim-box > .next { grid-column: 2; margin-top: var(--s-4); }
/* On touch (no hover to say it opens), the rows' chevron sits at the box's foot, on the next step's last line (3.11) */
.claim-box > span.go { position: absolute; right: var(--pad-card); bottom: calc(var(--pad-card) + 4px); }
@media (hover: none) { .claim-box > .next { padding-right: calc(16px + var(--s-3)); } }
@media (max-width: 639px) {
  .claim-box { column-gap: var(--s-4); }
  .claim-box > :is(.cb-chip, .cb-track, .next) { grid-column: 1 / -1; }
}

/* The tracker: four segments 4 high, done --green, to come --line-2, the stage names under it
   (current Bold --ink). Also drawn by the thread page's "About this conversation" (claimTracker) */
.tracker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: var(--s-5); }
.tracker > div { height: 4px; border-radius: 2px; background: var(--line-2); }
.tracker > div.on { background: var(--green); }
.tracker-l { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: var(--s-2); color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); }
.tracker-l [aria-current] { color: var(--ink); font-weight: 700; }

/* File a claim: the claim types as washing links into the flow, each with its type chosen, 2 by 2 (one
   column under 640): a 48 mint tile, the title (Body), the hint (Small --ink-2), no arrow (a chevron on
   touch only, 3.11). Containers, so --gap-cards apart, as the policy cards are */
.claim-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-cards); }
.claim-types > li { display: grid; }
.claim-type { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s-4); align-items: center; width: 100%; padding: var(--pad-tile); text-align: left; }
@media (hover: none) { .claim-type { grid-template-columns: 48px minmax(0, 1fr) 16px; } }
.claim-type .tx { display: grid; gap: 2px; min-width: 0; }
.claim-type .t { line-height: var(--lh-ui); }
.claim-type .s { color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); }
.claim-type:hover .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
@media (max-width: 639px) { .claim-types { grid-template-columns: minmax(0, 1fr); } }

/* Closed claims: rows with a 40 mint tile; the amount under the title in a narrow column */
.row.claim-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
@container (max-width: 480px) {
  .row.claim-row { grid-template-columns: 40px minmax(0, 1fr); }
  .row.claim-row > .it { grid-row: 1 / span 2; }
}

/* How your claims compare: a small door to How you compare (.box.edged), the sentence and the
   door's mini columns */
.claim-cmp .st { margin-top: var(--s-2); max-width: 62ch; }
.claim-cmp .viz { margin-top: var(--s-5); width: fit-content; }

/* ---------- A claim (4.16, 6.3) ---------- */
/* The timeline: a dot per stage (done: green with a check; now: the green ring), the line between two
   stages green once the claim has moved past the first of them */
.timeline { display: grid; }
.timeline li { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--s-4); padding-bottom: var(--s-5); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 9px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li.done:not(.now)::before { background: var(--green); }
/* On arriving at the page (motion.js's html.mo-enter, never on a re-render), the green line grows down to where the claim is,
   one stage after another, as the tracker's segments fill on Claims. html.mo-still (Motion: off, or reduced motion): drawn at once */
@keyframes clm-line { from { transform: scaleY(0); } to { transform: scaleY(1); } }
html.mo-enter:not(.mo-still) .timeline li.done:not(.now)::before { transform-origin: 50% 0; animation: clm-line var(--dur-4, 420ms) var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1)) both; }
html.mo-enter:not(.mo-still) .timeline li:nth-child(2).done:not(.now)::before { animation-delay: calc(120ms * var(--mo-k, 1)); }
html.mo-enter:not(.mo-still) .timeline li:nth-child(3).done:not(.now)::before { animation-delay: calc(240ms * var(--mo-k, 1)); }   /* done by 660ms, inside mo-enter's 700 */
.timeline .dot { position: relative; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--field); background: var(--canvas); color: var(--inverse-ink); }
.timeline li.done .dot { background: var(--green); box-shadow: none; }
.timeline li.done .dot svg.i { width: 14px; height: 14px; stroke-width: 2; }
.timeline li.now .dot { box-shadow: inset 0 0 0 3px var(--green); }
.timeline .t { line-height: var(--lh-ui); }
.timeline .t > b { font-weight: 400; }
.timeline li.now .t > b, .timeline li.done .t > b { font-weight: 700; }
.timeline .meta { display: block; margin-top: 2px; color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); }
.timeline .t .wait { color: var(--ink); font-weight: 700; }
.timeline .d { color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); white-space: nowrap; padding-top: 1px; }

/* Photos and documents: every row leads with a 40 tile, so the names line up: the photo itself where there's a picture
   (the one she chose, while the page lives, or the flow's drawn sample), else a mint tile with image or file. The download
   icon stays at the right at every width (styles.css moves a plain doc row's icon under 480) */
.row.doc.clm-doc { grid-template-columns: 40px minmax(0, 1fr) var(--icon); }
.row.doc.clm-doc > .go { grid-column: 3; grid-row: 1; }
.clm-thumb { position: relative; display: block; width: 40px; height: 40px; border-radius: var(--r-md); overflow: hidden; background: var(--g-10); }
.clm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.clm-thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line); }   /* a pale photo keeps its edge on white */

/* What she told us, under the claim's details: run-in sentences (the name Bold, then her words), 12 apart, a hairline above */
.clm-said { display: grid; gap: var(--s-3); margin-top: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.clm-said b { font-weight: 700; }

/* A closed claim's decision (4.16, 3.5): a .box with compensation.svg in its head, 32 under the timeline (F19) */
.claim-decision { margin-top: var(--s-6); }
.claim-decision .box-head + * { margin-top: var(--s-4); }

/* A closed claim's thread ends in the "This conversation is closed" box, 32 under the bubbles */
.thread + .claim-reply > .infobox { margin-top: var(--s-6); }

/* The right column: containers 16 apart (as the thread page's "About this conversation"), padding
   24 (16 on phones). Also the invoice page's e-invoicing and "Something wrong with it?" */
.claim-side { display: grid; gap: var(--s-4); align-content: start; align-items: start; }
/* Once the columns stack (under 1280), the boxes sit side by side at about their desktop width */
@media (min-width: 768px) and (max-width: 1279px) { .claim-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* push: also answers to the page area's width (branch ai-drawer README, the push layout) */
@media (min-width: 1024px) { @container app (max-width: 1279px) { .claim-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }} }
.claim-card { padding: var(--pad-tile); }
.claim-card > h2 + .kv { margin-top: var(--s-2); }
.person { display: flex; align-items: center; gap: var(--s-3); }
.person .nm { font-weight: 700; line-height: var(--lh-ui); }
.person .s { font-size: var(--fs-small); line-height: var(--lh-small); }
.claim-card .hrs { margin-top: var(--s-4); color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); }
/* The key-value list: no column gap, so each row's hairline runs unbroken under both cells */
.kv.tight { grid-template-columns: minmax(8em, max-content) minmax(0, 1fr); column-gap: 0; }
.kv.tight > :nth-child(even) { padding-left: var(--s-4); overflow-wrap: anywhere; text-align: right; }


/* ---------- Invoices (4.17) ---------- */

/* The tiles, then 48 under them the e-invoicing box (while it's off): the art and title in its head,
   the line under the title, the secondary at the right, the dismiss button in the corner */
.inv-top > .inv-einv, .inv-top > .inv-einv-ok { margin-top: var(--s-7); }
.inv-einv { display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; column-gap: var(--s-6); align-items: center; }
.inv-einv > .box-head { grid-column: 1; grid-row: 1; }
.inv-einv > p { grid-column: 1; grid-row: 2; margin: var(--s-1) 0 0 64px; max-width: 62ch; }   /* under the title: the 48 art and its 16 gap */
.inv-einv > .inv-einv-a { grid-column: 2; grid-row: 1 / span 2; }
.inv-einv > .x { grid-column: 3; grid-row: 1; align-self: start; display: grid; place-items: center; width: 32px; height: 32px; margin: -8px -8px 0 0; border-radius: 50%; color: var(--ink); }
.inv-einv > .x:hover { background: var(--hover); }
.inv-einv > .x svg.i { width: 16px; height: 16px; }
@media (max-width: 767px) {
  .inv-einv { grid-template-columns: minmax(0, 1fr) 32px; column-gap: var(--s-3); }
  .inv-einv > p { grid-column: 1 / -1; margin: var(--s-3) 0 0; }
  .inv-einv > .inv-einv-a { grid-column: 1 / -1; grid-row: 3; margin-top: var(--s-5); }
  .inv-einv > .x { grid-column: 2; }
}

/* All invoices: the table Janne likes, without the arrow column. Header 40 high, Small --ink-2;
   year rows Label; rows 56 high with hairlines; the whole row is the month's stretched link and
   washes --hover (--pressed when pressed), its name underlining. "Due" keeps its outline chip */
.table { width: 100%; border-collapse: collapse; }
.table th { height: 40px; padding: 0 var(--s-4) 0 0; text-align: left; font-weight: 400; color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); border-bottom: 1px solid var(--line); }
.table th.r, .table td.r { text-align: right; }
.table tr.grp th { height: auto; padding: var(--s-6) 0 var(--s-2); border-bottom: 0; color: var(--ink); font-weight: 700; font-size: var(--fs-body); line-height: var(--lh-ui); }
.table tbody:first-of-type tr.grp th { padding-top: var(--s-5); }
.table td { height: 56px; padding: 0 var(--s-4) 0 0; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background-color var(--t-hover); }
.table td:last-child, .table th:last-child { padding-right: 0; }
.table tr.link-row { position: relative; }
.table tr.link-row:hover td { background: var(--hover); }
.table tr.link-row:hover .mo a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.table tr.link-row:active td { background: var(--pressed); }
.table tr.link-row:active { --ink-2: var(--ink-2-press); }
.table tr.link-row .mo a { color: inherit; text-decoration: none; }
.table tr.link-row .mo a::after { content: ""; position: absolute; inset: 0; }
.table tr.link-row .mo a:focus-visible { outline: none; }
.table tr.link-row:has(a:focus-visible) { outline: var(--v8-focus); outline-offset: 0; box-shadow: var(--v8-focus-glow); }
/* The wash bleeds 12 past the text on both sides, as a row's does, without moving the hairlines */
.table tr.link-row:hover td:first-child { box-shadow: -12px 0 0 var(--hover); }
.table tr.link-row:hover td:last-child { box-shadow: 12px 0 0 var(--hover); }
.table tr.link-row:active td:first-child { box-shadow: -12px 0 0 var(--pressed); }
.table tr.link-row:active td:last-child { box-shadow: 12px 0 0 var(--pressed); }
.table .amt { font-variant-numeric: tabular-nums; }
.table .subtle { color: var(--ink-2); }
.inv-meta { display: none; color: var(--ink-2); font-size: var(--fs-small); line-height: var(--lh-small); }
@media (max-width: 767px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td, .table th { display: block; }
  .table tr.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-4); padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; transition: background-color var(--t-hover), box-shadow var(--t-hover); }
  .table tr.link-row td { height: auto; padding: 0; border: 0; background: none !important; box-shadow: none !important; }
  .table tr.link-row:hover { background: var(--hover); box-shadow: -12px 0 0 var(--hover), 12px 0 0 var(--hover); }
  .table tr.link-row:active { background: var(--pressed); box-shadow: -12px 0 0 var(--pressed), 12px 0 0 var(--pressed); }
  .table tbody:last-child tr.link-row:last-child { border-bottom: 0; }
  .table td.due, .table td.no { display: none; }
  .table td.mo { grid-row: 1 / span 2; }
  .table td.amt { grid-row: 1; grid-column: 2; }
  .table td.st { grid-row: 2; grid-column: 2; justify-self: end; }
  .table tr.grp th { padding: var(--s-5) 0 var(--s-1); }
  .inv-meta { display: block; }
}
@media (max-width: 374px) { .table tr.link-row { column-gap: var(--s-2); } }
@media (max-width: 359px) { .inv-meta .inv-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
/* On touch the row's chevron (span.go, 3.11) sits at its right end, with room made for it */
@media (hover: none) {
  .inv-table tr.link-row span.go { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
  .inv-table tr.link-row td.st { padding-right: calc(16px + var(--s-3)); }
}
@media (hover: none) and (max-width: 767px) {
  .inv-table tr.link-row { padding-right: calc(16px + var(--s-3)); }
  .inv-table tr.link-row td.st { padding-right: 0; }
}

/* ---------- An invoice (4.18) ---------- */
/* The amount block as a container; "What it's for" open under it, 48 apart. The bars take each
   policy's --pol-<id> color inline (it has to beat .hbar .fill) */
.amount { font-size: var(--fs-title); line-height: var(--lh-title); letter-spacing: var(--track-tight); font-variant-numeric: tabular-nums; }
.copyv { display: inline-flex; align-items: center; gap: var(--s-2); justify-content: flex-end; }
.copy { flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: -6px 0; border-radius: 50%; color: var(--ink); }
.copy:hover { background: var(--hover); }
.copy svg.i { width: 18px; height: 18px; }
.kv .tot { font-weight: 700; color: var(--ink) !important; }
/* In a narrow amount block the payment details stack, the name over the value, so an IBAN never
   breaks mid-number */
.inv-amount { container-type: inline-size; }
.copyv .num:not(.brk) { white-space: nowrap; }
@container (max-width: 400px) {
  .inv-amount .kv.tight { grid-template-columns: minmax(0, 1fr); }
  .inv-amount .kv.tight > :nth-child(odd) { padding-bottom: 0; border-bottom: 0; }
  .inv-amount .kv.tight > :nth-child(even) { padding: 2px 0 var(--s-3); text-align: left; }
  .inv-amount .kv.tight > :nth-last-child(2) { border-bottom: 0; }
  .inv-amount .copyv { display: flex; justify-content: space-between; }
}
.inv-card > p { margin-top: var(--s-3); }
.inv-card > .btn { margin-top: var(--s-5); }
