/* Section: الزكاة والصدقة (P7, on the API). The approved demo's charity.css: the tabs, the rows, the donation screen
   and form, the beneficiary screen with its IBAN box, and the allocations («المرصود»). Only the :root tokens from
   app.css; zakat and sadaqah keep their own colours. */

/* Tabs: «المستفيدين» gets a dark chip so it never looks like the zakat colour (brand and zakat share a hue). */
.ch-tabs {
  margin: 0 0 12px;
}

.ch-tabs .chips {
  flex-wrap: wrap;
}

.ch-tabs .chip-on:not(.chip-zakat):not(.chip-sadaqah) {
  border-color: var(--text);
  background: var(--text);
}

.ch-total-count {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.ch-hint {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------ rows */

.ch-rel {
  margin-inline-start: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.ch-iban-mini {
  font-size: 14px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.ch-sums {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ch-sum {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.ch-sum-zakat {
  color: var(--zakat);
}

.ch-sum-sadaqah {
  color: var(--sadaqah);
}

/* ------------------------------------------------------------ donation screen */

.ch-type-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  margin: 0 0 14px;
  padding: 10px 18px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.3;
}

.ch-type-big .icon svg {
  width: 28px;
  height: 28px;
  stroke-width: 2;
}

.ch-type-zakat {
  background: var(--zakat);
}

.ch-type-sadaqah {
  background: var(--sadaqah);
}

.ch-notes {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.btn.ch-danger {
  color: var(--late);
}

.btn.ch-danger:hover:not(:disabled) {
  border-color: var(--late);
}

/* ------------------------------------------------------------ donation form: beneficiary lines */

.ch-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ch-lines > .btn {
  align-self: flex-start;
}

.ch-line-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ch-line {
  padding: 6px 12px 12px;
  padding-inline-end: 6px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ch-line-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ch-line-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.ch-line-new {
  margin: 0 0 6px;
}

.ch-line .money-field {
  margin-inline-end: 6px;
}

.ch-line .input[aria-invalid='true'] {
  border-color: var(--late);
  background: var(--late-soft);
}

.ch-lines-empty {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.ch-lines-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  /* Neutral on purpose: the brand colour is also the zakat colour, and this total shows for sadaqah too. */
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
}

.ch-lines-sum .money {
  font-size: 19px;
}

.segmented.ch-seg4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segmented.ch-seg4 .seg {
  padding-inline: 4px;
}

/* ------------------------------------------------------------ beneficiary screen */

.ch-name-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
}

.ch-name-link .icon svg {
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.ch-iban-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1.5px dashed var(--field-line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-align: start;
}

button.ch-iban-box {
  cursor: pointer;
}

button.ch-iban-box:hover {
  border-color: var(--brand);
}

/* While the server answers a reveal (an audited POST). */
button.ch-iban-box:disabled {
  cursor: progress;
  opacity: 0.7;
}

.ch-iban-open {
  border-style: solid;
  border-color: var(--brand);
  background: var(--surface);
}

.ch-iban-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.ch-iban-full {
  flex: 1 1 220px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Roboto Mono', 'Droid Sans Mono', monospace;
  font-size: 19px;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

.ch-iban-group {
  white-space: nowrap;
}

.ch-iban-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 15px;
  font-weight: 800;
}

.ch-no-iban {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.ch-table th,
.ch-table td {
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  text-align: start;
}

.ch-table thead th {
  padding-top: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.ch-table tbody tr:last-child th,
.ch-table tbody tr:last-child td {
  border-bottom: 0;
}

.ch-table tbody th {
  font-weight: 800;
}

.ch-table .ch-num {
  text-align: end;
}

.ch-table .ch-col-zakat {
  color: var(--zakat);
}

.ch-table .ch-col-sadaqah {
  color: var(--sadaqah);
}

.ch-nil {
  color: var(--muted);
  font-weight: 400;
}

/* ------------------------------------------------------------ allocations (المبالغ المرصودة) */

.ch-alloc-top {
  margin: 0 0 18px;
}

.ch-alloc-top > .btn {
  margin-top: 10px;
}

.ch-alloc-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ch-alloc-sub .money {
  color: var(--text);
}

/* A small "used" bar inside a row. */
.ch-bar {
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.ch-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.ch-bar-zakat {
  background: var(--zakat);
}

.ch-bar-sadaqah {
  background: var(--sadaqah);
}

/* Donor totals: two per line on a phone; a big amount may drop its «ر.س» to the next line instead of overflowing. */
.ch-alloc-totals .totals {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ch-alloc-totals .total-value {
  font-size: 18px;
}

.ch-alloc-totals .total-value .money {
  white-space: normal;
}

.ch-alloc-totals .total-late {
  background: var(--late-soft);
}

.ch-alloc-totals .total-late .total-label,
.ch-alloc-totals .total-late .total-value {
  color: var(--late);
}

/* 'من: زكاة ذهب 1,000.00 + …' under a donation on the donor page. */
.ch-from {
  overflow-wrap: anywhere;
}

.ch-from bdi {
  font-weight: 700;
  color: var(--text);
}

/* «انخصمت من» on the donation screen: one allocation per line. */
.ch-parts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.ch-part {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 6px;
}

.ch-link {
  color: var(--brand-ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

/* «الباقي من المرصود» hint in the donation form. */
.ch-left {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 15px;
  font-weight: 700;
}

.ch-left-zakat {
  background: var(--zakat-soft);
  color: var(--zakat);
}

.ch-left-sadaqah {
  background: var(--sadaqah-soft);
  color: var(--sadaqah);
}

.ch-left-note {
  flex-basis: 100%;
  color: var(--late);
  font-size: 14px;
}

/* A donor that cannot be changed (the form was opened from that donor's page). */
.ch-fixed {
  display: flex;
  align-items: center;
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
}
