/* Trip Cost Splitter styles */
:root {
  color-scheme: light dark;
  --page: #f7f7f8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #111113;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: var(--w-text-base)/1.5 var(--w-font);
  color: var(--w-fg);
  background: var(--page);
  overflow-x: hidden;
}

.container {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: var(--w-space-4);
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--w-space-4);
  width: 100%;
}

@media (max-width: 768px) {
  .container {
    grid-template-columns: 1fr;
  }
}

.panel {
  padding: var(--w-space-5);
  margin-bottom: var(--w-space-4);
  min-width: 0;
  overflow-wrap: break-word;
}

.w-heading {
  margin: var(--w-space-5) 0 var(--w-space-3) 0;
  font: 600 var(--w-text-lg)/1.3 var(--w-font);
}

.w-heading:first-child {
  margin-top: 0;
}

/* People list */
.people-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--w-space-3) 0;
}

.person-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--w-space-2) var(--w-space-3);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  margin-bottom: var(--w-space-2);
  background: var(--w-muted-bg);
  gap: var(--w-space-2);
  min-width: 0;
}

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

.form-row {
  display: flex;
  gap: var(--w-space-2);
  align-items: flex-start;
}

.form-row .w-input {
  flex: 1;
  min-width: 0;
}

/* Sample badge */
.sample-badge {
  display: flex;
  align-items: center;
  gap: var(--w-space-2);
  margin-bottom: var(--w-space-3);
  flex-wrap: wrap;
}

/* Expenses list */
.expenses-list {
  list-style: none;
  padding: 0;
  margin: var(--w-space-3) 0 0 0;
}

.expense-item {
  padding: var(--w-space-3);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  margin-bottom: var(--w-space-2);
  background: var(--w-muted-bg);
  min-width: 0;
}

.expense-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--w-space-3);
  margin-bottom: var(--w-space-2);
  min-width: 0;
}

.expense-header > div {
  min-width: 0;
  flex: 1;
}

.expense-desc {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: var(--w-space-1);
}

.expense-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.expense-meta {
  font-size: var(--w-text-sm);
  color: var(--w-muted);
  line-height: 1.6;
  word-break: break-word;
}

.expenses-empty {
  padding: var(--w-space-4);
  text-align: center;
  color: var(--w-muted);
  margin-top: var(--w-space-3);
}

/* Balances */
.balances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--w-space-4);
  margin-bottom: var(--w-space-5);
}

.balance-item {
  text-align: center;
  min-width: 0;
}

.balance-name {
  font-size: var(--w-text-sm);
  color: var(--w-muted);
  margin-bottom: var(--w-space-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-amount {
  font: 600 var(--w-text-2xl)/1.2 var(--w-font);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.balance-positive {
  color: var(--w-success);
}

.balance-negative {
  color: var(--w-destructive);
}

.balance-zero {
  color: var(--w-muted);
}

/* Settlement */
.settlement-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: settlement;
}

.settlement-item {
  counter-increment: settlement;
  padding: var(--w-space-3);
  border: 1px solid var(--w-border);
  border-radius: var(--w-radius);
  margin-bottom: var(--w-space-2);
  background: var(--w-muted-bg);
  position: relative;
  padding-left: var(--w-space-6);
  word-break: break-word;
  min-width: 0;
}

.settlement-item::before {
  content: counter(settlement) ".";
  position: absolute;
  left: var(--w-space-3);
  font-weight: 600;
  color: var(--w-muted);
}

.settlement-empty {
  padding: var(--w-space-4);
  text-align: center;
  color: var(--w-success);
  font-weight: 500;
}

/* Person details tabs */
.details-section {
  margin-bottom: var(--w-space-5);
}

.details-section:last-child {
  margin-bottom: 0;
}

.details-heading {
  font-weight: 600;
  font-size: var(--w-text-base);
  margin: 0 0 var(--w-space-3) 0;
  color: var(--w-muted);
}

.details-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--w-space-3) 0;
}

.details-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--w-space-2) 0;
  border-bottom: 1px solid var(--w-border);
  gap: var(--w-space-3);
  min-width: 0;
}

.details-item:last-child {
  border-bottom: none;
}

.details-desc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-meta {
  font-size: var(--w-text-sm);
  color: var(--w-muted);
}

.details-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.details-total {
  display: flex;
  justify-content: space-between;
  padding: var(--w-space-3) 0 0 0;
  border-top: 2px solid var(--w-border);
  font-weight: 600;
  margin-top: var(--w-space-2);
  gap: var(--w-space-3);
}

.details-empty {
  padding: var(--w-space-4);
  text-align: center;
  color: var(--w-muted);
  font-style: italic;
}

/* Dialog */
.dialog-actions {
  display: flex;
  gap: var(--w-space-2);
  justify-content: flex-end;
  margin-top: var(--w-space-5);
  flex-wrap: wrap;
}

#splitBetween {
  display: flex;
  flex-direction: column;
  gap: var(--w-space-2);
}

.split-checkbox {
  display: flex;
  align-items: center;
  gap: var(--w-space-2);
}

/* Error states */
.w-hint:not(:empty) {
  color: var(--w-destructive);
  margin-top: var(--w-space-1);
}
