:root {
  --ink: #17231e;
  --ink-soft: #516159;
  --forest: #173f32;
  --forest-dark: #102e25;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #ddd8cc;
  --coral: #ef765f;
  --gold: #e8ae4b;
  --mint: #7eb9a0;
  --blue: #7e9fc2;
  --plum: #a48aa8;
  --danger: #a44135;
  --shadow: 0 16px 40px rgba(25, 44, 36, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

html.dialog-open,
body.dialog-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(239, 118, 95, 0.08), transparent 28rem),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

input[readonly],
select:disabled,
input:disabled:not([type="checkbox"]) {
  color: #625f57;
  background: #f0eee7;
  cursor: not-allowed;
}

.limited-edit-note {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  background: #f0eee7;
  font-size: 0.78rem;
  line-height: 1.45;
}

.split-payer-locked {
  cursor: not-allowed;
}

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

a {
  color: var(--forest);
}

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

h1,
h2,
h3 {
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 500;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.site-header {
  height: 72px;
  padding: 0 max(20px, calc((100vw - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 35, 30, 0.1);
  background: rgba(245, 241, 232, 0.92);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--coral);
  color: white;
  font-family: Georgia, serif;
  font-size: 1.3rem;
}

.header-actions,
.header-actions form {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-actions .user-name-mobile {
  display: none;
}

.page-wrap {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.page-heading {
  padding: 72px 0 36px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}

.page-heading h1 {
  margin-bottom: 8px;
}

.page-heading p:last-child {
  color: var(--ink-soft);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.muted {
  color: var(--ink-soft);
}

.card {
  background: var(--card);
  border: 1px solid rgba(23, 35, 30, 0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.icon-button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(126, 159, 194, 0.48);
  outline-offset: 2px;
}

.button-primary {
  color: white;
  background: var(--forest);
  box-shadow: 0 7px 18px rgba(23, 63, 50, 0.16);
}

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

.button-accent {
  color: var(--ink);
  background: var(--gold);
}

.button-secondary {
  color: var(--forest);
  background: transparent;
  border-color: var(--line);
}

.button-quiet {
  color: var(--ink-soft);
  background: transparent;
  border-color: transparent;
}

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

.button-small {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.86rem;
}

.button-full {
  width: 100%;
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-bottom: 80px;
}

.trip-card {
  min-height: 245px;
  padding: 24px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.trip-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 48px rgba(25, 44, 36, 0.13);
}

.trip-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.trip-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: var(--forest);
  font-family: Georgia, serif;
  font-size: 1.7rem;
}

.tag {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 99px;
  color: var(--forest);
  background: #e4eee8;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.trip-card h3 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.trip-card p,
.trip-label {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.trip-total {
  margin-top: 22px;
  font-family: Georgia, serif;
  font-size: 2rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 56px 24px;
  text-align: center;
}

.empty-illustration {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--mint);
  border-radius: 50%;
  color: var(--forest);
  font-size: 2rem;
}

.empty-state p {
  max-width: 440px;
  margin: 0 auto;
  color: var(--ink-soft);
}

.auth-shell {
  background: var(--forest);
  color: white;
}

.auth-shell .site-header {
  position: absolute;
  width: 100%;
  color: white;
  background: transparent;
  border: 0;
}

.auth-shell .brand {
  color: white;
}

.auth-layout {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  padding: 120px 0 70px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  align-items: center;
  gap: clamp(50px, 8vw, 110px);
}

.auth-intro h1 {
  max-width: 720px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 6vw, 5.7rem);
}

.auth-intro h1 em {
  color: var(--gold);
  font-weight: inherit;
}

.auth-intro > p:not(.eyebrow) {
  max-width: 590px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.06rem;
}

.mini-settlement {
  width: min(360px, 100%);
  margin-top: 44px;
  display: flex;
  align-items: center;
}

.settlement-line {
  height: 1px;
  flex: 1;
  background: rgba(255, 255, 255, 0.25);
}

.settlement-amount {
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  font-weight: 800;
}

.auth-card {
  padding: 36px;
  color: var(--ink);
}

.auth-card h2 {
  margin-bottom: 8px;
}

.auth-alternate {
  margin: 24px 0 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.form-stack {
  display: grid;
  gap: 18px;
}

label,
legend {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 750;
}

.label-line {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbc7bc;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffefb;
}

select {
  appearance: none;
  padding-right: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 24px) 50%,
    calc(100% - 17px) 50%;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}

textarea {
  resize: vertical;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.alert {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.alert-error {
  color: #812e24;
  background: #f9dfda;
}

.alert-success {
  color: #1e5b45;
  background: #dceee5;
}

.invite-share {
  margin-bottom: 20px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1.2fr);
  align-items: center;
  gap: 18px;
  border-color: rgba(232, 174, 75, 0.55);
}

.invite-share strong {
  display: block;
  margin-bottom: 3px;
}

.invite-share p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.copy-field {
  display: flex;
  gap: 8px;
}

.copy-field input {
  min-width: 0;
  min-height: 40px;
  font-size: 0.78rem;
}

.copy-field .button {
  white-space: nowrap;
}

.trip-hero {
  padding: 34px 0 42px;
  color: white;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 55%),
    var(--forest);
}

.back-link {
  display: inline-block;
  margin-bottom: 35px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.86rem;
}

.back-link-light {
  padding: 8px 11px;
  border: 1px solid rgba(21, 38, 31, 0.28);
  border-radius: 999px;
  color: #0b241b;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 750;
}

.back-link:hover,
.back-link-light:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.trip-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.trip-title-row h1 {
  margin: 10px 0 7px;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
}

.trip-title-row p {
  color: rgba(255, 255, 255, 0.65);
}

.tag-light {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.hero-total {
  margin-top: 38px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.hero-total span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-total strong {
  font-family: Georgia, serif;
  font-size: 2rem;
}

.trip-content {
  padding-top: 32px;
  padding-bottom: 70px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.panel,
.expenses-panel,
.people-panel {
  padding: 26px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.panel-heading h2 {
  margin: 0;
}

.panel-heading .eyebrow {
  margin-bottom: 7px;
}

.hero-actions,
.transaction-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settlement-list,
.balance-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.settlement-item,
.balance-row {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.settlement-item-clickable {
  padding: 0;
}

.settlement-item-clickable button {
  width: 100%;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  color: inherit;
  text-align: left;
  background: transparent;
}

.settlement-item-clickable button:hover {
  background: rgba(23, 63, 50, 0.055);
}

.settlement-dialog {
  padding: 34px 38px 38px;
}

.settlement-visual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 20px 0;
}

.settlement-person {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.settlement-person .avatar {
  width: 58px;
  height: 58px;
  font-size: 1.25rem;
}

.settlement-person strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.settlement-person span {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settlement-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.settlement-flow span {
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    var(--forest),
    var(--forest) 8px,
    transparent 8px,
    transparent 14px
  );
}

.settlement-flow span:last-child::after {
  content: "";
  float: right;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-top: 2px solid var(--forest);
  border-right: 2px solid var(--forest);
  transform: rotate(45deg);
}

.settlement-flow strong {
  color: var(--forest);
  font-family: Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.payment-instructions {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf5;
}

.payment-instructions span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-instructions p {
  margin: 0;
  overflow-wrap: anywhere;
}

.settlement-confirm {
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid var(--line);
  opacity: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition:
    max-height 360ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-top 260ms ease,
    padding-top 260ms ease,
    opacity 280ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.settlement-confirm[data-expanded="true"] {
  max-height: 720px;
  margin-top: 16px;
  padding-top: 16px;
  opacity: 1;
  overflow: visible;
  transform: translateY(0);
}

.settlement-readonly {
  margin-bottom: 0;
}

.settlement-people,
.person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settlement-people span:not(.avatar),
.balance-value span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.money {
  white-space: nowrap;
  font-family: Georgia, serif;
  font-size: 1.15rem;
}

.all-set {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.all-set > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--mint);
}

.all-set p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 850;
}

.avatar-coral { background: var(--coral); }
.avatar-gold { background: var(--gold); }
.avatar-mint { background: var(--mint); }
.avatar-blue { background: var(--blue); }
.avatar-plum { background: var(--plum); }

.balance-value {
  text-align: right;
}

.balance-value strong {
  display: block;
}

.balance-value.positive strong { color: #36775d; }
.balance-value.negative strong { color: var(--danger); }
.balance-value.neutral strong { color: var(--ink-soft); }

.expenses-panel,
.people-panel {
  margin-top: 20px;
}

.expense-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.transaction-row-settlement {
  background: linear-gradient(90deg, rgba(126, 185, 160, 0.09), transparent 42%);
}

.transaction-row-settlement .date-tile strong,
.transaction-row-settlement .expense-amount {
  color: var(--forest);
}

.transaction-row-settlement .expense-main h3::after {
  content: "Transfer";
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--forest);
  background: #e4eee8;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.expense-row-edit,
.expense-row-static {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.expense-row-edit {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  color: inherit;
  text-align: left;
  background: transparent;
  transition: background 120ms ease;
}

.expense-row-edit:hover {
  background: rgba(23, 63, 50, 0.055);
}

.expense-row-edit:focus-visible {
  outline: 3px solid rgba(126, 159, 194, 0.48);
  outline-offset: 2px;
}

.expense-row-static {
  padding: 8px;
}

.date-tile {
  text-align: center;
}

.date-tile strong,
.date-tile span {
  display: block;
}

.date-tile strong {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  line-height: 1;
}

.date-tile span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.date-tile-empty strong,
.date-tile-empty span {
  color: #928d82;
}

.date-tile-empty strong {
  font-family: inherit;
}

.expense-main h3 {
  margin: 0 0 5px;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.expense-main p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.expense-main .expense-note {
  margin-top: 4px;
  font-style: italic;
}

.expense-amount {
  font-family: Georgia, serif;
  font-size: 1.12rem;
  white-space: nowrap;
}

.expense-action-spacer {
  width: 32px;
}

.expense-delete-form {
  display: flex;
}

.icon-button,
.chip-remove {
  border: 0;
  cursor: pointer;
  color: var(--ink-soft);
  background: transparent;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.member-actions form {
  display: flex;
}

.text-button {
  min-height: 30px;
  padding: 4px 7px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  color: var(--forest);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.text-button:hover {
  background: #e4eee8;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.45rem;
}

.icon-button:hover,
.chip-remove:hover {
  color: var(--danger);
  background: rgba(164, 65, 53, 0.08);
}

.empty-list {
  padding: 36px 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.empty-list p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.people-hint {
  font-size: 0.78rem;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.person-card {
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 0.85rem;
}

.person-card-invited {
  cursor: pointer;
}

.person-card-invited:hover {
  border-color: var(--mint);
  background: #fbfdf9;
}

.person-details {
  min-width: 0;
}

.person-details strong,
.person-details span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-details span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.73rem;
}

.member-status {
  padding: 4px 7px;
  border-radius: 99px;
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-linked {
  color: #2e684f;
  background: #e0eee7;
}

.status-pending {
  color: #815f1c;
  background: #f7e8c7;
}

.chip-remove {
  width: 25px;
  height: 25px;
  border-radius: 50%;
}

.participant-picker {
  position: relative;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.typeahead-control {
  position: relative;
}

.typeahead-control input {
  padding-right: 42px;
}

.search-mark {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-size: 1.25rem;
  pointer-events: none;
}

.typeahead-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 22px);
  z-index: 12;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 18px 42px rgba(25, 44, 36, 0.18);
}

.typeahead-option,
.typeahead-invite-option {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 13px;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.typeahead-option:hover,
.typeahead-option:focus-visible,
.typeahead-option.is-active,
.typeahead-invite-option:hover,
.typeahead-invite-option:focus-visible,
.typeahead-invite-option.is-active {
  outline: 0;
  background: #edf3ef;
}

.typeahead-option strong,
.typeahead-option span {
  display: block;
}

.typeahead-option span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.typeahead-invite-option {
  min-height: 46px;
  border-bottom: 0;
  color: var(--forest);
  font-weight: 800;
}

.typeahead-empty {
  margin: 0;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.invite-dialog-copy {
  margin: -8px 0 0;
  font-size: 0.84rem;
}

.invite-help {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.danger-zone {
  margin-top: 26px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.danger-zone summary {
  cursor: pointer;
  margin-bottom: 12px;
}

.modal {
  width: min(480px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 20px;
  padding: 0;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 32px 100px rgba(10, 25, 19, 0.32);
}

.modal::backdrop {
  background: rgba(10, 25, 19, 0.68);
  backdrop-filter: blur(3px);
}

.modal > form {
  width: 100%;
  min-width: 0;
  padding: 28px;
}

.invite-link-dialog {
  padding: 28px;
}

.copy-field-stacked {
  margin-top: 18px;
  align-items: stretch;
}

.copy-field-stacked input {
  flex: 1;
}

.modal-wide {
  width: min(650px, calc(100% - 28px));
}

.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
}

.modal-heading h2 {
  margin-bottom: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.span-2 {
  grid-column: 1 / -1;
}

.money-input {
  position: relative;
}

.money-input > span {
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 650;
}

.money-input input {
  padding-left: 36px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 8px 0 12px;
  padding: 4px;
  border-radius: 10px;
  background: #ece8de;
  min-width: 0;
}

.segmented-control-three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented-control label {
  min-width: 0;
  display: block;
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: block;
  padding: 8px;
  border-radius: 7px;
  text-align: center;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.segmented-control input:checked + span {
  background: white;
  box-shadow: 0 2px 8px rgba(23, 35, 30, 0.08);
}

.split-list {
  border-top: 1px solid var(--line);
}

.split-help {
  min-height: 18px;
  margin: -4px 0 10px;
  font-size: 0.76rem;
}

.split-member {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.check-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.check-label span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.check-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--forest);
}

.check-label .avatar {
  width: 32px;
  height: 32px;
}

.custom-amount {
  display: none;
  width: 120px;
}

.custom-amount input {
  min-height: 38px;
}

.custom-split .custom-amount {
  display: block;
}

.everyone-split .split-member {
  opacity: 0.72;
}

.split-check {
  min-height: 20px;
  margin: 8px 0 0;
  text-align: right;
  font-size: 0.78rem;
}

.split-ok { color: #36775d; }
.split-warning { color: var(--danger); }
.optional { color: var(--ink-soft); font-weight: 400; }

.simple-page {
  width: min(800px, calc(100% - 40px));
  margin: 100px auto;
  text-align: center;
}

.profile-wrap {
  padding: 64px 0 90px;
}

.profile-card {
  width: min(540px, 100%);
  margin: 24px auto 0;
  padding: 32px;
}

.profile-card h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 6vw, 4rem);
}

.profile-card .form-stack {
  margin-top: 26px;
}

.profile-detail {
  display: grid;
  gap: 7px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.profile-detail span {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-detail strong {
  color: var(--ink);
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.field-help {
  display: block;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
}

.consent-check {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.45;
}

.consent-check input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--forest);
}

@media (max-width: 840px) {
  .trip-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .auth-layout {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 120px;
  }

  .auth-intro {
    text-align: center;
  }

  .auth-intro > p:not(.eyebrow),
  .mini-settlement {
    margin-left: auto;
    margin-right: auto;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .segmented-control-three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .site-header {
    height: 62px;
    padding: 0 16px;
  }

  .header-actions {
    gap: 8px;
  }

  .header-actions .user-name-desktop {
    display: none;
  }

  .header-actions .user-name-mobile {
    display: inline-flex;
  }

  .user-name-mobile,
  .inline-logout .button {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }

  .page-wrap {
    width: min(100% - 28px, 1160px);
  }

  .page-heading {
    padding: 42px 0 24px;
    align-items: center;
  }

  .page-heading h1 {
    font-size: 2.7rem;
  }

  .page-heading .button {
    min-height: 42px;
    padding: 9px 13px;
    font-size: 0.84rem;
  }

  .trip-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .trip-card {
    min-height: 210px;
  }

  .auth-layout {
    width: min(100% - 28px, 560px);
    padding: 94px 0 32px;
  }

  .auth-intro h1 {
    font-size: clamp(2.75rem, 13vw, 4.2rem);
  }

  .auth-intro > p:not(.eyebrow) {
    font-size: 0.95rem;
  }

  .mini-settlement {
    margin-top: 28px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .trip-hero {
    padding: 24px 0 30px;
  }

  .back-link {
    margin-bottom: 24px;
  }

  .trip-title-row {
    align-items: start;
  }

  .trip-title-row h1 {
    font-size: 2.7rem;
  }

  .hero-actions {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 8;
    justify-content: flex-end;
  }

  .hero-actions .button {
    min-height: 52px;
    border-radius: 99px;
    box-shadow: 0 10px 30px rgba(16, 46, 37, 0.3);
  }

  .hero-total {
    margin-top: 26px;
  }

  .trip-content {
    padding-top: 18px;
  }

  .panel,
  .expenses-panel,
  .people-panel {
    padding: 20px 16px;
  }

  .invite-share {
    grid-template-columns: 1fr;
  }

  .copy-field {
    align-items: stretch;
  }

  .expenses-heading .button {
    display: none;
  }

  .settlement-visual {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .settlement-dialog {
    padding: 24px 22px 28px;
  }

  .settlement-flow {
    width: min(260px, 100%);
    justify-self: center;
  }

  .expense-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 16px 0;
  }

  .expense-row-edit,
  .expense-row-static {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px 6px;
  }

  .expense-amount {
    align-self: start;
  }

  .delete-button {
    width: 32px;
    height: 32px;
  }

  .expense-action-spacer {
    display: none;
  }

  .profile-wrap {
    padding: 36px 0 70px;
  }

  .profile-card {
    padding: 24px 20px;
  }

  .people-grid {
    grid-template-columns: 1fr;
  }

  .person-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .person-card .member-actions {
    grid-column: 2 / -1;
    justify-self: end;
  }

  .typeahead-results {
    position: fixed;
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 16px;
    max-height: min(60vh, 430px);
    overflow-y: auto;
  }

  .copy-field-stacked {
    flex-direction: column;
  }

  .modal {
    width: min(560px, calc(100% - 28px));
    max-width: calc(100% - 28px);
    max-height: calc(100dvh - 28px);
    margin: auto;
    border-radius: 20px;
  }

  .modal > form {
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
