/* Group Expense Splitter (#006). Only this tool's own pieces; everything else is the shared tool frame.
   Colours come from the site's variables only (tests/catalogue.test.mjs checks there are no hex values here). */

/* Who's in: one box and Add, then the names as quiet chips (tap to rename or take out). */
.xs-hint { margin: -4px 0 8px; }
.xs-add { display: flex; gap: 8px; }
.xs-add .input { flex: 1; min-width: 0; }
.xs-add .btn { flex: none; }
.xs-status { margin: 6px 0 0; min-height: 1.4em; font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }
.xs-status.is-problem { color: var(--graphite); font-weight: 600; }
.xs-people { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.xs-person { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1.5px var(--silver); font: inherit; font-size: 16px; font-weight: 500; color: var(--graphite); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.xs-person:hover { box-shadow: inset 0 0 0 1.5px var(--graphite); }
.xs-person:focus-visible { outline: 3px solid var(--graphite); outline-offset: 2px; }
.xs-pedit { flex-basis: 100%; display: grid; gap: 8px; padding: 10px; border-radius: 12px; background: var(--mist); }
.xs-pedit__btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* What was paid: the amount first and large; the rest compact. */
.xs-exp { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--silver); }
.xs-exp__h { margin: 0 0 12px; }
.xs-money { font-size: 18px; font-variant-numeric: tabular-nums; }
.xs-mode legend { font-size: 14px; }
.xs-custom { margin: -4px 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--mist); }
.xs-custom .field__hint { margin: 0 0 10px; }
.xs-crows { display: grid; gap: 8px; }
.xs-crow { display: grid; grid-template-columns: minmax(0, 1fr) 120px; align-items: center; gap: 4px 10px; }
.xs-crow label { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.xs-crest { grid-column: 1 / -1; justify-self: end; min-height: 0; font-size: 13px; color: var(--slate); font-variant-numeric: tabular-nums; }
.xs-crest:empty { display: none; }
.xs-cstatus { margin: 10px 0 0; min-height: 1.4em; font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }
.xs-cstatus.is-problem { color: var(--graphite); font-weight: 600; }
.xs-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.xs-btns .btn--wide { flex: 1 1 100%; }
.xs-list-h { margin: 22px 0 8px; }
.xs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.xs-row { display: grid; gap: 2px; width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1px var(--silver); font: inherit; text-align: left; color: var(--graphite); cursor: pointer; }
.xs-row:hover, .xs-row.is-editing { box-shadow: inset 0 0 0 1.5px var(--graphite); }
.xs-row:focus-visible { outline: 3px solid var(--graphite); outline-offset: 2px; }
.xs-row__t { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.xs-row__what { min-width: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.xs-row__amt { flex: none; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.xs-row__sub { font-size: 13.5px; color: var(--slate); }

/* Payments already made: out of the way until needed. */
.xs-pay { margin-top: 22px; }
.xs-pay > summary { display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; list-style: none; }
.xs-pay > summary::-webkit-details-marker { display: none; }
.xs-pay > summary::after { content: "+"; margin-left: 8px; color: var(--slate); font-weight: 500; }
.xs-pay[open] > summary::after { content: "–"; }
.xs-pay__in { padding: 4px 0 6px; }
.xs-pay__in .field__hint { margin: 0 0 12px; }

/* Settle up: who pays whom, large; then the confirmation; the rest secondary. */
.xs-empty { margin: 0; padding: 30px 0 18px; font-size: 15px; color: var(--steel); }
.xs-settle-h { margin: 24px 0 0; font-size: 15px; font-weight: 600; color: var(--slate); }
.xs-tx { list-style: none; margin: 22px 0 0; padding: 0; display: grid; }
.xs-settle-h + .xs-tx { margin-top: 10px; }
.xs-t { display: flex; align-items: center; gap: 10px 14px; padding: 12px 0; border-bottom: 1px solid var(--mist); break-inside: avoid; }
.xs-t__who { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.xs-t__from, .xs-t__to { overflow-wrap: anywhere; }
.xs-arrow { flex: none; width: 20px; height: 20px; color: var(--slate); }
.xs-t__amt { flex: none; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.xs-paid { flex: none; }
.xs-done { margin: 16px 0 0; font-size: 16px; font-weight: 600; }
.xs-done.is-square { margin-top: 26px; font-size: 19px; }
.xs-bal { margin-top: 20px; }
.xs-bal > summary { display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; color: var(--slate); cursor: pointer; list-style: none; }
.xs-bal > summary::-webkit-details-marker { display: none; }
.xs-bal > summary::after { content: "+"; margin-left: 8px; font-weight: 500; }
.xs-bal[open] > summary::after { content: "–"; }
.xs-bal__in { padding-bottom: 4px; }
.xs-bl { list-style: none; margin: 0; padding: 0; display: grid; }
.xs-bl li { display: grid; gap: 2px; padding: 9px 0; border-bottom: 1px solid var(--mist); }
.xs-bl__t { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.xs-bl__n { min-width: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.xs-bl__w { flex: none; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.xs-bl__w.is-square { color: var(--slate); font-weight: 500; }
.xs-bl__f { font-size: 13.5px; color: var(--slate); font-variant-numeric: tabular-nums; }
.xs-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .xs-pair { grid-template-columns: 1fr; } }
.xs-print { display: none; }
.xs-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 15px; font-variant-numeric: tabular-nums; }
.xs-table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--slate); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--silver); }
.xs-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--mist); vertical-align: top; overflow-wrap: anywhere; }
.xs-table tbody th { font-size: 15px; color: var(--graphite); border-bottom: 1px solid var(--mist); }
.xs-table th[scope="row"] { font-weight: 600; text-align: left; padding-right: 10px; overflow-wrap: anywhere; }
.xs-table .xs-num { text-align: right; white-space: nowrap; }
.xs-table .xs-bw { white-space: nowrap; }
.xs-psec { margin-top: 20px; }
.xs-psec__h { margin: 0 0 4px; font-size: 15px; font-weight: 600; }

.xs-send { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.xs-send h2 { margin: 0; color: var(--slate); }
.xs-send__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.xs-secs { margin-top: 18px; }

@media (max-width: 560px) {
  .xs-t { flex-wrap: wrap; }
  .xs-t__who, .xs-t__amt { font-size: 18px; }
  .xs-send__btns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .xs-send__btns .btn { width: 100%; justify-content: center; min-height: 44px; white-space: nowrap; }
  .xs-send__btns #xs-copy { grid-column: 1 / -1; }
  .xs-crow { grid-template-columns: minmax(0, 1fr) 110px; }
}

@media print {
  .xs-print { display: block; }
  .xs-psec[data-pdf-out], .xs-psec--none { display: none !important; }
  .xs-t { padding: 7pt 0; border-bottom: 0.5pt solid var(--silver); }
  .xs-t__who, .xs-t__amt { font-size: 14pt; }
  .xs-arrow { width: 13pt; height: 13pt; }
  .xs-done { font-size: 11.5pt; }
  .xs-psec { margin-top: 14pt; break-inside: avoid; }
  .xs-psec__h { font-size: 11pt; }
  .xs-table { font-size: 10pt; }
}
