:root {
  color-scheme: light;
  --bg: #f4f5ef;
  --paper: #fffefb;
  --ink: #183d35;
  --muted: #566b63;
  --line: #d7e0d7;
  --soft: #e8efe5;
  --accent: #235d47;
  --on: #fff;
  --tint: #e2eddc;
  --warning: #805320;
  --danger: #9d3131;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101d19;
  --paper: #182a23;
  --ink: #edf2e7;
  --muted: #b2c4b9;
  --line: #3d5346;
  --soft: #253b2f;
  --accent: #b1d7a0;
  --on: #182a23;
  --tint: #294332;
  --warning: #f3c991;
  --danger: #ffb4ac;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.5 system-ui,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
summary {
  cursor: pointer;
}
button,
a,
summary {
  touch-action: manipulation;
}
button,
input,
select {
  min-height: 44px;
}
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  background: var(--soft);
  font-weight: 600;
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--paper);
  max-width: 100%;
  width: 100%;
}
input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  height: 22px;
  flex: none;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font:
    500 40px/1.2 Georgia,
    serif;
  letter-spacing: -0.8px;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 16px;
}
a {
  color: inherit;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.between {
  justify-content: space-between;
}
.stack {
  display: grid;
  gap: 16px;
}
.small,
small {
  font-size: 13px;
  color: var(--muted);
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  font-weight: 700;
}
.muted {
  color: var(--muted);
}
.mono {
  font-variant-numeric: tabular-nums;
}
.primary {
  background: var(--accent);
  color: var(--on);
  border-color: transparent;
}
.text {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 22px;
  background: var(--paper);
}
[hidden] {
  display: none !important;
}
.demo {
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 9px 14px;
  text-align: center;
}
.demo a {
  margin-left: 10px;
}
.shell {
  max-width: 1080px;
  margin: auto;
  padding: 0 28px 125px;
}
.header {
  padding: 23px 0 35px;
}
.brand {
  text-decoration: none;
  font-size: 19px;
  letter-spacing: -0.6px;
}
.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: var(--on);
  border-radius: 12px;
  font-weight: 700;
}
.heading {
  margin-bottom: 24px;
}
.heading p {
  margin-top: 8px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  min-width: 0;
}
.hero {
  background: var(--tint);
}
.total {
  font-size: clamp(32px, 4.5vw, 47px);
  font-weight: 650;
  letter-spacing: -1.4px;
  line-height: 1.2;
  margin: 14px 0 8px;
  overflow-wrap: anywhere;
}
.pill {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--soft);
}
.receipt-link {
  display: flex;
  width: 100%;
  gap: 14px;
  align-items: center;
  background: var(--paper);
  text-align: left;
  margin-top: 22px;
  padding: 16px;
  font-weight: 400;
}
.receipt-mark {
  font-size: 28px;
}
.receipt-link span:nth-child(2) {
  flex: 1;
  display: grid;
  gap: 3px;
}
.progress {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}
.track {
  height: 7px;
  border-radius: 9px;
  background: var(--line);
  overflow: hidden;
  margin: 12px 0;
}
.track i {
  display: block;
  background: var(--accent);
  height: 100%;
  border-radius: 9px;
}
.participants {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.person {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.person:last-child {
  border: 0;
}
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  background: var(--soft);
  border-radius: 12px;
  font-weight: 700;
}
.person button {
  display: flex;
  text-align: left;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background: none;
  border: 0;
}
.person .copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.person strong {
  overflow-wrap: anywhere;
}
.person .value {
  text-align: right;
  max-width: 50%;
  overflow-wrap: anywhere;
}
.people-foot {
  margin-top: 15px;
}
.items {
  grid-column: 1;
  grid-row: 2 / span 2;
}
.line {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 17px 0;
  font-weight: 400;
}
.line .copy {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.line strong {
  overflow-wrap: anywhere;
}
.line .price {
  text-align: right;
  font-size: 14px;
  max-width: 45%;
  overflow-wrap: anywhere;
}
.item-list {
  margin-top: 15px;
}
.extras {
  grid-column: 2;
  grid-row: 3;
}
.extras p {
  margin-top: 10px;
}
.note {
  font-size: 13px;
  padding: 14px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
}
summary {
  min-height: 44px;
  padding: 12px 0;
  color: var(--muted);
}
.notice {
  color: var(--warning);
  font-size: 14px;
}
.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  padding: 8px;
  display: flex;
  gap: 8px;
  max-width: calc(100% - 24px);
  box-shadow: 0 15px 50px #123b2d25;
}
.dock .primary {
  min-width: 190px;
}
.lab {
  margin-top: 30px;
  border-top: 1px dashed var(--line);
}
.lab .row {
  flex-wrap: wrap;
  align-items: flex-end;
}
.lab label {
  min-width: 180px;
  flex: 1;
}
.lab p {
  padding-top: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 12px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 14px;
}
.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.check input {
  width: 22px;
}
.validation {
  color: var(--danger);
  font-size: 14px;
}
.actions {
  display: grid;
  gap: 10px;
}
.danger {
  color: var(--danger);
}
.toast {
  position: fixed;
  bottom: 95px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 14px 18px;
  border-radius: 14px;
  z-index: 10;
  max-width: calc(100% - 24px);
  font-size: 14px;
}
dialog {
  width: min(520px, calc(100% - 32px));
  max-height: 92dvh;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop {
  background: #10271c80;
  backdrop-filter: blur(3px);
}
.sheet-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 1;
}
.sheet-body {
  padding: 24px;
  display: grid;
  gap: 18px;
}
.sheet-body p {
  font-size: 14px;
}
.paper {
  background: white;
  color: #222;
  padding: 28px 22px;
  font:
    14px/1.7 ui-monospace,
    monospace;
  border-radius: 5px;
  box-shadow: 0 5px 25px #0002;
  max-width: 340px;
  margin: auto;
  width: 100%;
}
.paper h3,
.paper .center {
  text-align: center;
}
.paper .rule {
  border-top: 1px dashed #777;
  margin: 18px 0;
}
.paper .row {
  align-items: flex-start;
  justify-content: space-between;
  font-size: 13px;
}
.paper .row span {
  overflow-wrap: anywhere;
}
.image-box {
  max-height: 55vh;
  overflow: auto;
  border-radius: 12px;
  background: var(--soft);
  padding: 10px;
}
.image-box img {
  width: 100%;
  display: block;
}
.image-box img.zoom {
  width: 170%;
  max-width: none;
}
.receipt-fields {
  display: grid;
  gap: 12px;
}
.assign-row {
  display: grid;
  grid-template-columns: 1fr 85px;
  gap: 12px;
  align-items: center;
}
.assign-row input {
  width: 100%;
}
.disabled-state {
  padding: 30px;
  display: grid;
  gap: 15px;
  text-align: center;
}
.kpis {
  display: grid;
  gap: 10px;
}
.kpis .row {
  justify-content: space-between;
}
.lab a {
  display: inline-block;
  min-height: 44px;
  padding: 12px 0;
}
@media (max-width: 759px) {
  .shell {
    padding: 0 18px 130px;
  }
  .header {
    padding: 18px 0 27px;
  }
  .brand {
    font-size: 17px;
  }
  .heading h1 {
    font-size: 34px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  .layout > * {
    width: 100%;
  }
  .card {
    padding: 22px;
  }
  .total {
    font-size: 38px;
  }
  .items {
    order: 2;
  }
  .participants {
    order: 1;
  }
  .extras {
    order: 3;
  }
  .dock {
    width: calc(100% - 24px);
    bottom: 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .dock .primary {
    flex: 1;
    min-width: 0;
  }
  .dock button {
    font-size: 14px;
  }
  dialog {
    margin: auto 0 0;
    width: 100%;
    max-width: none;
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet-body {
    padding: 22px;
  }
}
@media (max-width: 350px) {
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }
  .brand {
    font-size: 15px;
    gap: 7px;
  }
  .header .row {
    gap: 6px;
  }
  .header button {
    padding: 8px;
  }
  .total {
    font-size: 31px;
  }
  .card {
    padding: 18px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .person {
    gap: 8px;
  }
  .dock button {
    font-size: 13px;
    padding: 9px;
  }
}

[hidden] {
  display: none !important;
}
.receipt-image {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  margin: auto;
}
.receipt-image.zoom {
  max-height: none;
  width: 100%;
  cursor: zoom-out;
}
.item-list {
  max-height: 560px;
  overflow: auto;
}
.payment-card {
  grid-column: 1/-1;
}
.status-message {
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
  font-size: 14px;
}
input,
select {
  max-width: 100%;
}
.item {
  width: 100%;
  text-align: left;
}
.person button {
  flex-shrink: 0;
}
.people-foot {
  line-height: 1.5;
}
.sheet-body label {
  display: block;
  margin: 12px 0;
}
.sheet-body input {
  width: 100%;
}
.person .grow {
  flex: 1;
  min-width: 0;
}
.person > .mono {
  text-align: right;
  font-size: 14px;
  max-width: 38%;
}
.person button.icon {
  flex: 0 0 30px;
  justify-content: center;
  min-height: 44px;
}
.item-list .item {
  padding: 16px 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  font-weight: 400;
  gap: 12px;
}
.item-list .item > span {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.item-list .item > .mono {
  max-width: 42%;
  text-align: right;
  font-size: 14px;
}
.item-list .item .small {
  display: block;
}
.item-list .item:disabled {
  opacity: 1;
}
label:has(#metricsConsent) {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}
#metricsConsent {
  width: 18px;
  flex: 0 0 18px;
  margin-top: 2px;
}
.sheet-body input[type="checkbox"] {
  width: auto;
}
.sheet-body button {
  margin-top: 8px;
}
.mono {
  overflow-wrap: anywhere;
}
.participants > .row,
.items > .row {
  flex-wrap: wrap;
}
.items #itemsHint {
  flex-basis: 100%;
}
#addPerson {
  flex-shrink: 0;
}
.item-list .item > span {
  overflow-wrap: anywhere;
}
.allocation-fields {
  border: 0;
  padding: 0;
  margin: 18px 0;
  min-width: 0;
}
.allocation-fields legend {
  font-weight: 600;
  margin-bottom: 8px;
}
.sheet-body .assign-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
}
.sheet-body .allocation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
