/* HouseSplit - cream / black / white, PT Serif, built for thumbs. */

:root {
  --cream: #F6EFE1;
  --cream-deep: #EDE2CD;
  --white: #FFFFFF;
  --ink: #16130F;
  --ink-soft: #6B6255;
  --line: #E1D6C0;
  --red: #A82A1E;
  --red-soft: #FBEDEB;

  --r-card: 24px;
  --r-btn: 20px;
  --pad: 20px;

  --shadow: 0 2px 0 rgba(22, 19, 15, 0.04), 0 8px 24px rgba(22, 19, 15, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  font-family: 'PT Serif', Georgia, 'Times New Roman', serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

#app { max-width: 560px; margin: 0 auto; }

.view {
  display: none;
  padding: max(24px, env(safe-area-inset-top)) var(--pad)
           calc(40px + env(safe-area-inset-bottom));
  animation: rise 0.22s ease both;
}
.view.active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

/* ----------------------------------------------------------- typography */

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.head { margin: 8px 0 26px; }
.head h2 { font-size: 30px; line-height: 1.2; }
.sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 16px; font-style: italic; }

.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; margin: 0 0 12px -6px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--white); color: var(--ink);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.back:active { background: var(--cream-deep); }

/* ---------------------------------------------------------------- gate */

.gate { padding-top: 12vh; text-align: center; }

.wordmark { font-size: 42px; letter-spacing: -0.02em; }
.wordmark span { font-style: italic; font-weight: 400; }

.tagline {
  margin: 4px 0 40px;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
}

.gate .field { text-align: left; }

/* --------------------------------------------------------------- forms */

.field { display: block; margin-bottom: 24px; }

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-row .label { margin-bottom: 8px; }
.count { font-size: 14px; font-style: italic; color: var(--ink-soft); }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 17px; /* >=16px so iOS doesn't zoom on focus */
  box-shadow: var(--shadow);
}
input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 19, 15, 0.12);
}
input::placeholder { color: #B7AC98; }

.money-input { position: relative; }
.money-input .money-sign {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  font-size: 19px; color: var(--ink-soft); pointer-events: none;
}
.money-input input { padding-left: 36px; font-size: 19px; }

/* ------------------------------------------------------------- buttons */

.btn {
  display: block;
  width: 100%;
  min-height: 62px;
  padding: 17px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.985); }

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  box-shadow: var(--shadow);
}
.btn-primary:active { background: #2A241D; }
.btn-primary[disabled] { opacity: 0.55; cursor: default; }

.btn-outline {
  background: var(--white);
  color: var(--ink);
  border-color: var(--ink);
}
.btn-outline:active { background: var(--cream-deep); }

.btn-danger {
  background: var(--white);
  color: var(--red);
  border: 2px solid var(--red);
  min-height: 56px;
  font-size: 17px;
}
.btn-danger:active { background: var(--red-soft); }

.btn-quiet {
  width: auto;
  min-height: 0;
  margin: 0 auto;
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 400;
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-everyone {
  min-height: 52px;
  margin-bottom: 12px;
  background: var(--white);
  color: var(--ink);
  border: 1px dashed var(--ink-soft);
  font-size: 17px;
}
.btn-everyone.on {
  background: var(--ink);
  color: var(--cream);
  border-style: solid;
  border-color: var(--ink);
}

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

/* The secondary zone is pushed well clear of the primary actions so a
   stray thumb can't land on Cancel / Switch User. */
.secondary-zone {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  text-align: center;
}

/* -------------------------------------------------------- people picker */

.people-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.person {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease;
}
.person:active { transform: scale(0.97); }
.person.on { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.person .tick { font-size: 14px; opacity: 0; }
.person.on .tick { opacity: 1; }
.person .you {
  font-size: 12px; font-style: italic; font-weight: 400;
  color: var(--ink-soft); letter-spacing: 0.04em;
}
.person.on .you { color: var(--cream-deep); }

/* ------------------------------------------------------------- receipt */

.receipt {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--white);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.receipt-item { font-size: 26px; font-weight: 700; line-height: 1.25; }
.receipt-cost { font-size: 34px; font-weight: 700; margin-top: 2px; }

.receipt-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 16px;
}
.receipt-row:first-of-type { margin-top: 18px; }
.receipt-row dt { color: var(--ink-soft); font-style: italic; }
.receipt-row dd { margin: 0; text-align: right; font-weight: 700; }

.names { text-align: right; font-weight: 700; }

/* --------------------------------------------------------------- costs */

.totals-bar {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 20px;
  margin-bottom: 22px;
  border-radius: var(--r-card);
  background: var(--ink);
  color: var(--cream);
}
.totals-bar .big { font-size: 26px; font-weight: 700; }
.totals-bar .small { font-size: 14px; font-style: italic; opacity: 0.8; }

.group { margin-bottom: 26px; }

.group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  margin: 0 4px 10px;
}
.group-head h3 { font-size: 21px; }
.group-head .meta { font-size: 14px; font-style: italic; color: var(--ink-soft); }

.item-card {
  padding: 16px 18px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--white);
  box-shadow: var(--shadow);
}
.item-top { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.item-name { font-size: 18px; font-weight: 700; }
.item-cost { font-size: 19px; font-weight: 700; white-space: nowrap; }

.item-meta { margin-top: 4px; font-size: 13px; font-style: italic; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cream-deep);
  font-size: 13px;
  font-weight: 700;
}
.chip.me { background: var(--ink); color: var(--cream); }

.empty {
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
  color: var(--ink-soft);
  font-style: italic;
}

/* --------------------------------------------------------- error, toast */

.error {
  margin: -8px 0 18px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 15px;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(90vw, 460px);
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(22, 19, 15, 0.25);
  animation: rise 0.2s ease both;
}

/* --------------------------------------------------------- venmo cards */

.month-field { margin-bottom: 22px; }

.hint {
  margin: 12px 4px 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-style: italic;
  text-align: center;
}

.shot {
  margin-top: 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--white);
  box-shadow: var(--shadow);
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}
.shot-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.shot-foot .who { font-size: 17px; font-weight: 700; }
.shot-foot .who small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
}
.btn-save {
  width: auto;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn-save:active { background: #2A241D; }

/* Export actions read as a different kind of button from Add / View: same
   shape and size, outlined rather than filled. */
.btn-export {
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
}
.btn-export:active { background: var(--cream-deep); }

/* --------------------------------------------------------------- select */

.select-wrap { position: relative; }

.select-wrap select {
  width: 100%;
  padding: 16px 46px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--shadow);
}
.select-wrap select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 19, 15, 0.12);
}
.select-arrow {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--ink-soft);
  pointer-events: none;
}

input[type="date"] {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  box-shadow: var(--shadow);
  appearance: none;
  -webkit-appearance: none;
  min-height: 58px;
}
input[type="date"]:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(22, 19, 15, 0.12);
}
#add-date-note { display: block; margin-top: 8px; }

/* ----------------------------------------------------------- edit item */

.item-card.mine { cursor: pointer; }

.item-edit {
  margin-top: 12px;
  padding: 9px 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.item-edit:active { background: var(--cream-deep); }

/* Edit sits hard left, Delete hard right, with the whole card width between
   them - the two are never adjacent tap targets. */
.item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-delete {
  margin-top: 12px;
  padding: 9px 18px;
  border: 2px solid var(--red);
  border-radius: 999px;
  background: var(--white);
  color: var(--red);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.item-delete:active { background: var(--red-soft); }
.item-delete[disabled] { opacity: 0.55; }
.item-foot .edited {
  flex: 1;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  font-style: italic;
  color: var(--ink-soft);
}
