.tx-list {
  margin-bottom: 2rem;
}

.tx-row {
  display: grid;
  grid-template-columns: 7rem 1fr 8rem 6rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 2px;
  background: var(--container);
  cursor: pointer;
  user-select: none;
}

.tx-row:hover {
  background: var(--highlight, #f5f5f5);
}

.tx-row.settlement {
  background: #d8d8d8;
  border-color: #aaa;
}

.tx-date {
  font-size: 0.8em;
  color: #888;
  white-space: nowrap;
}

.tx-desc {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-payer {
  font-size: 0.85em;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-amount {
  font-weight: 700;
  color: var(--primary);
  text-align: right;
}

.tx-row.settlement .tx-amount {
  color: #444;
}

.tx-detail {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 0.75rem 1rem;
  background: var(--bg);
  margin-bottom: 8px;
}

.tx-shares {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tx-shares .share-item {
  background: var(--container);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  display: flex;
  gap: 0.5rem;
  font-size: 0.85em;
}

.tx-shares .share-item.disabled {
  opacity: 0.5;
}

.tx-shares .share-dollars {
  color: var(--primary);
  font-weight: 600;
}

.tx-note {
  font-style: italic;
  font-size: 0.85em;
  color: #666;
  border-left: 3px solid var(--primary);
  padding-left: 0.5rem;
  margin-bottom: 0.5rem;
}

.tx-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.tx-actions form {
  display: inline;
  margin: 0;
}

@media (max-width: 600px) {
  .tx-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 1rem;
    margin-bottom: 6px;
  }

  .tx-desc {
    font-size: 1.1em;
    font-weight: 600;
    white-space: normal;
    overflow: visible;
  }

  .tx-amount {
    font-size: 1.4em;
    text-align: left;
  }

  .tx-date {
    font-size: 1em;
  }

  .tx-payer {
    display: block;
    font-size: 1em;
  }

  .tx-shares .share-item {
    font-size: 1em;
    padding: 0.5rem 0.75rem;
  }

  .tx-note {
    font-size: 1em;
  }

  .tx-detail {
    padding: 1rem;
  }

  .tx-actions {
    gap: 0.75rem;
  }
}

/* home.html */
.action-card {
  background: var(--container);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.action-card h2 {
  margin-top: 0;
}
.divider {
  text-align: center;
  color: #999;
  font-weight: bold;
}

/* expense_grid.html */
.settle-up-section {
  margin-bottom: 1.5rem;
  text-align: left;
}
.settle-up-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
  &:hover {
    opacity: 0.9;
  }
}
.invite-link-section {
  margin-top: 1.5rem;
  text-align: left;
}
.no-participants {
  text-align: center;
  padding: 2rem;
  background: var(--bg);
  border-radius: 8px;
}
.excluded-note {
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
  margin-top: 0.35rem;
}

/* manage_participants.html */
.participant-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 10px;
  background: var(--container);
  &.disabled {
    opacity: 0.5;
    background: var(--bg);
  }
}
.participant-name {
  flex: 1;
  font-weight: bold;
}
.participant-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.participant-actions form {
  margin: 0;
}
.edit-form {
  display: none;
  flex: 1;
  gap: 10px;
  align-items: center;
  &.active {
    display: flex;
  }
}
.edit-form input {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--primary);
  border-radius: 4px;
}
.share-box {
  background: var(--bg);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.share-box h3 {
  margin-top: 0;
}
.share-code {
  font-family: monospace;
  font-size: 1.5em;
  font-weight: bold;
  padding: 10px;
  background: var(--container);
  border: 2px dashed var(--primary);
  border-radius: 4px;
  text-align: center;
}
.add-participant {
  margin-bottom: 20px;
}
.add-participant form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.add-participant input {
  flex: 1;
}

/* add_transaction.html + edit_transaction.html */
.transaction-form {
  background: var(--container);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.shares-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.share-input label {
  display: block;
  margin-bottom: 0.25rem;
}
.audit-notice {
  background: var(--highlight);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary);
}
.audit-notice strong {
  display: block;
  margin-bottom: 0.5rem;
}

/* settlement.html */
.balances-section,
.debts-section,
.manual-settlement {
  margin-bottom: 2rem;
}
.balances-section h2,
.debts-section h2,
.manual-settlement h2 {
  margin-bottom: 1rem;
}
.balances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.balance-card {
  background: var(--container);
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  border: 2px solid var(--border);
  &.positive {
    border-color: var(--success);
  }
  &.negative {
    border-color: var(--danger);
  }
  &.zero {
    border-color: var(--secondary);
  }
}
.balance-card h3 {
  margin: 0 0 0.5rem 0;
}
.balance-card .balance {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0.5rem 0;
}
.balance-card small {
  color: #666;
}
.debts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.debt-item {
  background: var(--container);
  padding: 1.5rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.debt-info {
  flex: 1;
}
.debt-info .amount {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--primary);
  margin-left: 1rem;
}
.manual-settlement form {
  background: var(--container);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Utility classes */
.card {
  background: var(--container);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.card h2, .card h3 {
  margin-top: 0;
}
.action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.event-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.event-list-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.home-hero {
  text-align: center;
  max-width: 600px;
  margin: 60px auto;
}
.form-actions {
  margin-top: 20px;
}
.balance-positive {
  color: #4caf50;
}
.balance-negative {
  color: var(--danger);
}
.disabled-section {
  opacity: 0.6;
}
.btn-full {
  width: 100%;
}

@media (width <= 768px) {
  .container {
    max-width: 100%;
    padding-inline: 0.75rem;
    font-size: 1.35rem;
  }
  .home-hero {
    margin: 30px auto;
  }

  button, .btn, .btn-primary, .btn-secondary,
  .success-btn, .warning-btn, .danger-btn,
  .edit-btn, .enable-btn, .add-transaction-btn,
  .settle-up-btn {
    padding: 0.4rem 0.8rem;
    font-size: 1rem;
  }
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    padding: 0.75rem;
    font-size: 1.1rem;
  }

  .action-card {
    padding: 1.5rem;
  }
  .participant-actions {
    width: 100%;
    margin-top: 10px;
  }
  .participant-row {
    flex-wrap: wrap;
  }
  .add-participant form {
    flex-direction: column;
  }
  .add-participant input {
    width: 100%;
  }
  .transaction-form {
    padding: 1rem;
  }
  .shares-grid {
    grid-template-columns: 1fr;
  }
  .balances-grid {
    grid-template-columns: 1fr;
  }
  .debt-item {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  .manual-settlement form {
    padding: 1rem;
  }
}

/* ParticipantManager (receipt wizard) */
.participant-manager {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.participant-manager h3 {
  margin-top: 0;
}
.participant-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.participant-list li {
  background: var(--container);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.9em;
}
.add-participant-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.add-participant-inline input {
  flex: 1;
}
