:root {
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f2f4f7;
  --text: #111827;
  --muted: #667085;
  --border: #e4e7ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success-bg: #ecfdf3;
  --success-text: #027a48;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.06);
  --radius-large: 24px;
  --radius-medium: 16px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.page-shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 24px 18px 120px;
}

.landing-shell {
  display: grid;
  align-content: center;
  min-height: 100vh;
  padding-bottom: 40px;
}

.hero {
  padding: 32px 4px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 30px;
  place-items: center;
  border-radius: 15px;
  background: var(--text);
  color: white;
  font-size: 20px;
  font-weight: 700;
}

.hero-copy {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.card,
.summary-card {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  padding: 22px;
}

.summary-card {
  padding: 26px;
  background: var(--text);
  color: white;
}

.summary-card .muted {
  color: #b7bdc8;
}

.summary-total {
  margin: 12px 0 24px;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.summary-meta {
  display: flex;
  gap: 20px;
  color: #d0d5dd;
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 4px 26px;
}

.join-code {
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  text-align: right;
}

.join-code span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.join-code strong {
  font-size: 16px;
  letter-spacing: 0.08em;
}

.stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  outline: none;
  background: var(--surface);
  color: var(--text);
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.button {
  display: inline-grid;
  min-height: 52px;
  padding: 0 18px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
  text-decoration: none;
  font-weight: 650;
}

.button-primary {
  background: var(--primary);
  color: white;
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-compact {
  min-width: 74px;
  background: var(--text);
  color: white;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.count-pill {
  display: grid;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 700;
}

.upload-zone {
  display: grid;
  min-height: 150px;
  padding: 24px;
  place-items: center;
  align-content: center;
  border: 1.5px dashed #cbd1da;
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  text-align: center;
  cursor: pointer;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-title {
  margin-bottom: 6px;
  font-weight: 700;
}

.upload-copy {
  color: var(--muted);
  font-size: 13px;
}

.status-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-small);
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 14px;
  font-weight: 600;
}

.person-list,
.item-list {
  display: grid;
  gap: 10px;
}

.person-row,
.item-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.person-row:last-child,
.item-row:last-child {
  border-bottom: 0;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 700;
}

.person-details {
  display: grid;
  gap: 4px;
}

.person-details span,
.item-row span {
  color: var(--muted);
  font-size: 13px;
}

.item-row {
  justify-content: space-between;
}

.item-row > div {
  display: grid;
  gap: 5px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 18px;
}

.manual-item-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.empty-state {
  padding: 22px;
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.bottom-spacer {
  height: 20px;
}

.bottom-action {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: auto minmax(180px, 360px);
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.bottom-action > div {
  display: grid;
  gap: 3px;
}

.bottom-action span {
  color: var(--muted);
  font-size: 12px;
}

.bottom-action strong {
  font-size: 18px;
}

@media (max-width: 520px) {
  .topbar {
    display: grid;
  }

  .join-code {
    width: fit-content;
    text-align: left;
  }

  .bottom-action {
    grid-template-columns: auto 1fr;
    gap: 14px;
  }

  .bottom-action .button {
    min-width: 0;
  }
}


/* Who Pay What participant editor and receipt extraction */

.section-help {
  margin: -6px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.participant-editor {
  display: grid;
  gap: 8px;
}

.participant-edit-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.participant-edit-row:last-child {
  border-bottom: 0;
}

.participant-edit-row input {
  min-height: 46px;
  border-color: transparent;
  background: transparent;
  font-weight: 600;
}

.participant-edit-row input:hover {
  background: var(--surface-muted);
}

.participant-edit-row input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.participant-new-row {
  opacity: 0.72;
}

.participant-new-row:focus-within {
  opacity: 1;
}

.participant-row-deleted {
  display: none;
}

.icon-button {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b42318;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.icon-button:hover {
  background: #fef3f2;
}

.creator-pill {
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.button-full {
  width: 100%;
  margin-top: 16px;
}

.button-attention {
  border-color: var(--primary);
  color: var(--primary);
}

.save-status {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.save-status-success {
  color: var(--success-text);
}

.save-status-error {
  color: #b42318;
}

.notice {
  margin-bottom: 18px;
  padding: 15px 16px;
  border: 1px solid;
  border-radius: var(--radius-medium);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.notice-success {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647;
}

.notice-error {
  border-color: #fecdca;
  background: #fef3f2;
  color: #b42318;
}

.extraction-progress {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 16px;
  padding: 15px;
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
}

.extraction-progress[hidden] {
  display: none;
}

.extraction-progress > div:last-child {
  display: grid;
  gap: 4px;
}

.extraction-progress span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.progress-spinner {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 3px solid #d0d5dd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: receipt-spin 0.8s linear infinite;
}

@keyframes receipt-spin {
  to {
    transform: rotate(360deg);
  }
}

.charge-breakdown {
  display: grid;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.charge-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: #d0d5dd;
  font-size: 13px;
}

.charge-breakdown strong {
  color: white;
}

@media (max-width: 420px) {
  .participant-edit-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .participant-edit-row .avatar {
    width: 38px;
    height: 38px;
  }

  .icon-button {
    padding: 0 7px;
    font-size: 11px;
  }
}


/* Who Pay What assignment and summary flow */

.assignment-header {
  padding: 12px 4px 26px;
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.assignment-person-section {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.assignment-person-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
  font-size: 13px;
}

.assignment-person-heading span {
  color: var(--muted);
}

.participant-selector {
  display: flex;
  gap: 9px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.participant-selector::-webkit-scrollbar {
  display: none;
}

.participant-selector-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 5px 13px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.participant-selector-button.is-active {
  border-color: var(--text);
  background: var(--text);
  color: white;
}

.selector-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
}

.assignment-progress-card {
  margin-bottom: 16px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--surface);
}

.assignment-progress-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
  font-size: 13px;
}

.assignment-progress-card span {
  color: var(--muted);
}

.assignment-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.assignment-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 180ms ease;
}

.assignment-item-list {
  display: grid;
  gap: 12px;
}

.assignment-item-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.04);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.assignment-item-card.is-active-person-assigned {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.assignment-item-main {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.assignment-item-main > div {
  display: grid;
  gap: 5px;
}

.assignment-item-name {
  font-size: 15px;
  font-weight: 700;
}

.assignment-item-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.assigned-person-chips {
  display: flex;
  gap: 7px;
  padding: 0 18px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.assigned-person-chips::-webkit-scrollbar {
  display: none;
}

.assigned-person-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.assigned-person-chip.is-selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
}

.assignment-card-status {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.assignment-status-text {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-assignment-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.assignment-bottom-action {
  grid-template-columns: minmax(100px, auto) minmax(180px, 360px);
}

.final-total-card {
  display: grid;
  margin-bottom: 18px;
  padding: 26px;
  border-radius: var(--radius-large);
  background: var(--text);
  color: white;
}

.final-total-card span,
.final-total-card small {
  color: #b7bdc8;
}

.final-total-card strong {
  margin: 10px 0 18px;
  font-size: 44px;
  letter-spacing: -0.05em;
}

.summary-people-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.person-summary-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.person-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.person-summary-header > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.person-summary-header h2 {
  margin: 0 0 4px;
}

.person-summary-header span {
  color: var(--muted);
  font-size: 11px;
}

.person-summary-header > strong {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.summary-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 750;
}

.summary-line-items {
  display: grid;
  padding: 4px 20px 16px;
}

.summary-line-items > div,
.summary-charge-lines > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  font-size: 13px;
}

.summary-line-items span {
  display: grid;
  gap: 3px;
}

.summary-line-items small {
  color: var(--muted);
  font-size: 10px;
}

.summary-charge-lines {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.summary-charge-lines span {
  color: var(--muted);
}

.copy-summary-card {
  margin-top: 18px;
}

.notice p {
  margin: 8px 0 16px;
  font-weight: 400;
}

@media (max-width: 520px) {
  .assignment-bottom-action {
    grid-template-columns: minmax(90px, auto) 1fr;
  }

  .assignment-item-main {
    padding: 16px;
  }

  .assigned-person-chips {
    padding-right: 16px;
    padding-left: 16px;
  }

  .assignment-card-status {
    padding-right: 16px;
    padding-left: 16px;
  }
}
