/* Split expenses calculator (/tools/split-expenses-calculator): people list, expense cards,
   "split between" chips and the settle-up transfer list. Builds on the .nk-* tools block in site.css. */

/* People: two columns of name fields on wide cards, one column on phones. */
.nk-se-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 10px;
}
.nk-se-person {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}

/* One expense = a small parchment card. */
.nk-se-expense {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: #f7f1e8;
}
.nk-se-expense__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}
/* Amount + paid by, side by side; the right edge lines up with the description field. */
.nk-se-expense__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 8px;
  padding-right: 44px;
}
.nk-se-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.nk-se-field > span {
  font-size: 13px;
  font-weight: 600;
  color: #7a6a5c;
}
.nk-se-expense .nk-input {
  height: 46px;
}
.nk-se-select {
  height: 44px;
  padding-right: 36px;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238b5e3c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.nk-se-split {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.nk-se-split legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #7a6a5c;
}
.nk-se-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nk-se-chip {
  position: relative;
  cursor: pointer;
  max-width: 100%;
}
.nk-se-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.nk-se-chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid #ddd5c8;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #9a8570;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.nk-se-chip span::before {
  content: '';
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid #ddd5c8;
  box-sizing: border-box;
}
.nk-se-chip input:checked + span {
  background: #fffdf9;
  border-color: rgba(59, 48, 43, 0.22);
  color: #2e2018;
}
.nk-se-chip input:checked + span::before {
  border: 0;
  background: #7a9970
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.6 2.6L9 1.2' fill='none' stroke='%23fffdf9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 9px 7px no-repeat;
}
.nk-se-chip input:focus-visible + span {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.nk-se-chip:hover span {
  border-color: #c8bbae;
}
.nk-se-warn {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #8b5e3c;
}

/* Settle-up transfers. */
.nk-se-transfers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nk-se-transfers li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f7f1e8;
  font-size: 16px;
  color: #3b302b;
}
.nk-se-transfer__who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.nk-se-transfer__who strong {
  color: #2e2018;
  font-weight: 700;
}
.nk-se-transfer__amount {
  flex: none;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 20px;
  color: #2e2018;
  font-variant-numeric: tabular-nums;
}

/* Tables: row headers and positive balances. */
.nk-table tbody th.nk-se-rowhead {
  font-weight: 600;
  color: #2e2018;
  text-align: left;
  padding-left: 0;
  overflow-wrap: anywhere;
}
.nk-table td.nk-se-plus {
  color: #2e2018;
  font-weight: 700;
}

@media (max-width: 480px) {
  .nk-se-expense {
    padding: 12px;
  }
  .nk-se-expense .nk-input {
    padding: 0 10px;
    font-size: 16px;
  }
  .nk-se-select {
    padding-right: 32px !important;
    background-position: right 10px center;
  }
  .nk-se-expense__row {
    padding-right: 0;
  }
  .nk-se-compact .nk-table {
    font-size: 14px;
  }
  .nk-se-compact .nk-table th,
  .nk-se-compact .nk-table td {
    padding: 9px 6px;
  }
  .nk-se-compact .nk-table thead th {
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  .nk-se-transfers li {
    padding: 12px 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nk-se-chip span {
    transition: none;
  }
}

/* Disabled add/remove buttons (12-person limit, last person). */
[data-split-expenses] .nk-icon-btn:disabled,
[data-split-expenses] .nk-text-btn:disabled {
  opacity: 0.35;
  cursor: default;
  text-decoration: none;
  background: transparent;
}

/* Compact tables on phones: keep row labels readable instead of breaking mid-word. */
@media (max-width: 480px) {
  .nk-se-compact .nk-table tbody th.nk-se-rowhead {
    min-width: 72px;
    overflow-wrap: normal;
  }
}
