:root {
  --bg: #f6f3ea;
  --paper: #fffdfa;
  --ink: #17382e;
  --muted: #536a5e;
  --line: #d8dfd5;
  --accent: #1f5843;
  --on-accent: #fffdf5;
  --soft: #e6eee4;
}

.trip-app { font-variant-numeric: tabular-nums; }
.trip-app :is(h2, h3, p, ul, ol, dl, dd) { margin: 0; }
.trip-app :is(ul, ol) { list-style: none; padding: 0; }
.trip-app button { border-radius: .65rem; font-size: .875rem; min-height: 2.5rem; }
.trip-app label, .trip-app legend { font-size: .875rem; font-weight: 730; }
.trip-app label { display: block; margin-bottom: .35rem; }
.trip-app :is(input, select) { width: 100%; min-width: 0; border-radius: .5rem; }
.trip-app :is(input, select):disabled { opacity: .77; }
.trip-app [hidden] { display: none !important; }
.trip-app button:disabled { opacity: .58; cursor: default; }
.trip-app .trip-primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.trip-app .trip-primary:not(:disabled):hover { background: #173f33; }
.trip-app :is(input, button, select, summary):focus-visible { outline: 3px solid #a36119; outline-offset: 3px; }

.trip-banner {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(10rem, .55fr);
  gap: clamp(1.1rem, 3vw, 3rem);
  align-items: center;
  padding: 1.35rem clamp(1.1rem, 2.8vw, 2rem);
  border-radius: 1.1rem;
  color: #fffdf1;
  background: #173b30;
  background-image: repeating-linear-gradient(118deg, transparent 0 4.95rem, #e6eee40d 4.95rem 5rem);
}
.trip-banner label, .trip-metrics dt, .trip-banner small { color: #dce9d9; }
.trip-banner input, .trip-banner select { background: #fcfbf2; color: var(--ink); border-color: #fcfbf2; }
.trip-banner input { font-weight: 740; }
.trip-banner small { display: block; margin-top: .4rem; font-size: .75rem; }
.trip-metrics { display: flex; gap: clamp(1.4rem, 4vw, 3.25rem); }
.trip-metrics dt { font-size: .875rem; }
.trip-metrics dd { font-size: clamp(1.55rem, 3.4vw, 2.55rem); line-height: 1.08; letter-spacing: -.05em; font-weight: 800; overflow-wrap: anywhere; }
.trip-metrics dd span { font-size: 1rem; margin-left: .2rem; font-weight: 600; }

.trip-workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.15rem; margin-top: 1.15rem; }
.trip-ledger, .trip-results { display: grid; align-content: start; gap: 1.15rem; min-width: 0; }
.trip-card { padding: clamp(.95rem, 2vw, 1.35rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); min-width: 0; }
.trip-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; margin-bottom: .9rem; }
.trip-heading h2 { font-size: 1.12rem; letter-spacing: -.025em; }
.trip-caption { color: var(--muted); font-size: .875rem; }
.trip-empty { color: var(--muted); padding: .9rem; background: var(--bg); border-radius: .65rem; }
.trip-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.trip-people-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.trip-people-list:empty { display: none; }
.trip-people-list li { display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; gap: .35rem; align-items: center; padding: .25rem .35rem .25rem .7rem; border-radius: .7rem; border: 1px solid var(--line); background: var(--soft); }
.trip-people-list b { word-break: break-word; margin-right: .2rem; }
.trip-people-list button, .trip-item-actions button { border: 1px solid var(--line); padding: .28rem .45rem; min-height: 2rem; background: var(--paper); }
.trip-person-form { margin-top: .8rem; }
.trip-person-form input { flex: 1 0 8rem; }
.trip-expenses { display: grid; gap: .45rem; }
.trip-expense { border: 1px solid var(--line); border-radius: .7rem; min-width: 0; padding: .65rem .7rem; }
.trip-expense summary { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; cursor: pointer; list-style: none; }
.trip-expense summary::-webkit-details-marker { display: none; }
.trip-expense summary > span::before { content: '+'; color: var(--muted); margin-right: .4rem; }
.trip-expense details[open] summary > span::before { content: '−'; }
.trip-expense summary > span { overflow-wrap: anywhere; }
.trip-expense summary small { display: block; font-size: .8rem; margin: .2rem 0 0 .9rem; color: var(--muted); }
.trip-expense summary strong { white-space: nowrap; }
.trip-app .trip-shares-detail { margin: .5rem 0; padding: .3rem .65rem; border-radius: .55rem; background: var(--bg); }
.trip-shares-detail li { display: flex; gap: .7rem; justify-content: space-between; margin: .2rem 0; overflow-wrap: anywhere; }
.trip-shares-detail small { color: var(--muted); }
.trip-item-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.trip-expense-form { display: grid; gap: .4rem; margin-bottom: .8rem; padding: .9rem; border: 1px solid #a7bca8; border-radius: .65rem; background: var(--soft); }
.trip-expense-form :is(h3, input, select, fieldset, .trip-help) { margin-bottom: .25rem; }
.trip-expense-form label { margin: 0; }
.trip-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.trip-fields label { margin-bottom: .35rem; }
.trip-expense-form fieldset { border: 1px solid #b9c8b8; border-radius: .6rem; min-width: 0; margin-inline: 0; }
.trip-share-list { display: grid; gap: .35rem; }
.trip-share { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .65fr); align-items: center; gap: .5rem; }
.trip-share label { display: flex; align-items: center; gap: .45rem; word-break: break-word; }
.trip-share input[type='checkbox'] { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; margin: 0; accent-color: var(--accent); }
.trip-help { color: var(--muted); font-size: .875rem; }
.trip-form-error { color: #822e27; background: #fff2eb; padding: .5rem; border-radius: .4rem; }
.trip-table { max-width: 100%; overflow-x: auto; }
.trip-table table { width: 100%; border-collapse: collapse; }
.trip-table :is(th, td) { padding: .58rem .4rem; text-align: right; border-bottom: 1px solid var(--line); }
.trip-table thead { color: var(--muted); font-size: .875rem; }
.trip-table tr :first-child { text-align: left; overflow-wrap: anywhere; }
.trip-table td { white-space: nowrap; }
.trip-table tr:last-child td { border-bottom: 0; }
.trip-table .trip-net { font-weight: 800; color: var(--accent); }
.trip-table .trip-net.negative { color: #863c31; }
.trip-settlement { background: var(--soft); border-color: #c8d6c7; }
.trip-settlement .trip-empty { background: var(--paper); }
.trip-transfers li { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; margin-bottom: .4rem; padding: .8rem .75rem; border-radius: .6rem; background: var(--paper); }
.trip-route { overflow-wrap: anywhere; }
.trip-route span { color: var(--muted); margin: 0 .15rem; }
.trip-transfers strong { white-space: nowrap; }
.trip-export { margin-top: .9rem; }
.trip-print { display: none; }

@media (max-width: 760px) {
  .trip-banner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
  .trip-banner > :first-child { grid-column: 1 / -1; }
  .trip-metrics { gap: .75rem; justify-content: space-between; flex-wrap: wrap; }
  .trip-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 425px) {
  .trip-banner { gap: .8rem; }
  .trip-metrics { grid-column: 1/-1; justify-content: start; column-gap: 1.5rem; }
  .trip-banner-control { grid-column: 1/-1; }
  .trip-card, .trip-banner { border-radius: .7rem; }
  .trip-table :is(th, td) { padding-inline: .26rem; }
  .trip-table td { font-size: .875rem; }
}

@media print {
  @page { margin: 15mm; }
  .trip-app { display: none !important; }
  .trip-print { display: block !important; color: #17241c; background: white; }
  .trip-print h1 { font-size: 23pt; margin: .3em 0; }
  .trip-print h2 { font-size: 14pt; margin-top: 1.4em; }
  .trip-print .trip-table { overflow: visible; }
  .trip-print tr, .trip-print li { break-inside: avoid; }
  .trip-print ol { list-style: none; padding: 0; }
  .trip-print .trip-transfers li { border: 1px solid #e2e6e0; }
}
