:root {
  --bg: #fff9f0;
  --card: #ffffff;
  --ink: #2b3a42;
  --muted: #6b7a80;
  --line: #efe6d8;
  --teal: #2a9d8f;
  --teal-soft: #e3f4f1;
  --coral: #f4845f;
  --coral-soft: #fdeae3;
  --sun: #f6bd60;
  --sun-soft: #fdf3dc;
  --sage: #84a98c;
  --sage-soft: #eaf2eb;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(60, 50, 30, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--teal); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 .8em; }

.container { width: min(1100px, 100% - 2rem); margin: 0 auto; padding: 1.5rem 0 3rem; flex: 1; }
.loading { text-align: center; padding: 4rem; color: var(--muted); font-size: 1.2rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 249, 240, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1100px, 100% - 2rem); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem; padding: .7rem 0;
}
.brand { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand-icon { display: inline-block; transform: translateY(1px); }
.nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  text-decoration: none; color: var(--ink); padding: .4rem .85rem; border-radius: 999px;
  font-weight: 500; white-space: nowrap; transition: background .2s;
}
.nav a:hover { background: var(--sun-soft); }
.nav a.active { background: var(--teal); color: #fff; }
.me-chip {
  border: 2px dashed var(--coral); background: var(--coral-soft); color: var(--ink);
  border-radius: 999px; padding: .35rem .9rem; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.me-chip.set { border-style: solid; border-color: var(--sage); background: var(--sage-soft); }

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: .5rem; }
  .nav { order: 3; flex-basis: 100%; }
  .me-chip { margin-inline-start: auto; font-size: .9rem; }
}

/* ---------- hero ---------- */
.hero {
  position: relative; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow);
  background: #f7efe1 url('/img/hero.jpg') center / cover no-repeat;
  min-height: 360px; display: flex; align-items: flex-end; margin-bottom: 2rem;
}
.hero-text {
  margin: 1.5rem; padding: 1.4rem 1.6rem; max-width: 520px;
  background: rgba(255, 252, 246, .92); border-radius: 22px; backdrop-filter: blur(4px);
}
.hero-text p { color: var(--muted); font-size: 1.05rem; }

/* ---------- generic ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem; border: 1px solid var(--line);
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.pre { white-space: pre-wrap; }
.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  border: 2px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.5);
}
.empty .big { font-size: 2.6rem; display: block; margin-bottom: .3rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: none; cursor: pointer;
  font: inherit; font-weight: 600; padding: .6rem 1.15rem; border-radius: 999px;
  background: var(--teal); color: #fff; text-decoration: none; transition: transform .15s, box-shadow .15s, background .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(42,157,143,.25); }
.btn:active { transform: translateY(0); }
.btn.coral { background: var(--coral); }
.btn.coral:hover { box-shadow: 0 4px 12px rgba(244,132,95,.3); }
.btn.sun { background: var(--sun); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: #fff; box-shadow: none; }
.btn.danger { background: transparent; color: #c4553a; border: 1.5px solid #f2c8bc; }
.btn.sm { padding: .35rem .8rem; font-size: .9rem; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 1rem; color: var(--muted);
  width: 2rem; height: 2rem; border-radius: 50%;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .65rem; border-radius: 999px;
  font-size: .85rem; font-weight: 500; background: var(--sun-soft); color: #8a6420;
}
.pill.teal { background: var(--teal-soft); color: #1d6f65; }
.pill.coral { background: var(--coral-soft); color: #b0502f; }
.pill.sage { background: var(--sage-soft); color: #4e6e55; }

/* ---------- forms ---------- */
label.field { display: block; font-weight: 500; font-size: .95rem; }
label.field > span { display: block; margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .6rem .8rem; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fffdf9; transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
input[type='checkbox'] { width: 1.25rem; height: 1.25rem; accent-color: var(--teal); flex-shrink: 0; }
.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check-line { display: flex; gap: .5rem; align-items: center; font-weight: 500; cursor: pointer; }

/* ---------- modal ---------- */
.modal { border: none; padding: 0; background: transparent; width: min(640px, 100% - 1.5rem); max-height: 90vh; }
.modal::backdrop { background: rgba(43, 58, 66, .35); backdrop-filter: blur(3px); }
.modal[open] { animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card { background: var(--card); border-radius: 22px; padding: 1.4rem; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-head h3 { margin: 0; font-size: 1.3rem; }
.modal-body { max-height: 62vh; overflow-y: auto; padding: 2px; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-start; margin-top: 1.2rem; flex-wrap: wrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: #fff; padding: .7rem 1.3rem; border-radius: 999px;
  box-shadow: var(--shadow); transition: transform .3s, opacity .3s; z-index: 50; font-weight: 500; pointer-events: none; opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- trips ---------- */
.trip-card { display: flex; flex-direction: column; gap: .6rem; text-decoration: none; color: inherit; transition: transform .2s; }
.trip-card:hover { transform: translateY(-3px); }
.trip-card .when { color: var(--coral); font-weight: 600; font-size: .95rem; }
.progress { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--sage), var(--teal)); border-radius: 999px; transition: width .4s; }

.trip-header {
  background: linear-gradient(135deg, var(--teal-soft), var(--sun-soft));
  border-radius: 24px; padding: 1.5rem 1.6rem; margin-bottom: 1.2rem;
}
.trip-header h1 { margin-bottom: .3rem; }
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: 1.2rem; scrollbar-width: none; }
.tabs a {
  text-decoration: none; color: var(--ink); background: #fff; border: 1.5px solid var(--line);
  padding: .5rem 1rem; border-radius: 999px; white-space: nowrap; font-weight: 500;
}
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.info-list { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.info { background: var(--bg); border-radius: 14px; padding: .8rem 1rem; }
.info .k { font-size: .85rem; color: var(--muted); display: block; }
.info .v { font-weight: 500; white-space: pre-wrap; }
.info.full { grid-column: 1 / -1; }

.focal {
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  background: var(--coral-soft); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1rem;
}
.focal.has { background: var(--sage-soft); }
.focal .avatar { font-size: 2.2rem; }
.focal .grow { flex: 1; min-width: 200px; }

/* participants */
.fam-row {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 14px;
  background: #fff; border: 1.5px solid var(--line); flex-wrap: wrap;
}
.fam-row.on { border-color: var(--sage); background: #fbfdf9; }
.fam-row .name { flex: 1; min-width: 140px; font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: .3rem; background: var(--bg); border-radius: 999px; padding: .15rem; }
.stepper button {
  width: 1.9rem; height: 1.9rem; border-radius: 50%; border: none; background: #fff; cursor: pointer;
  font-size: 1.05rem; font-weight: 700; color: var(--teal); box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stepper b { min-width: 1.4rem; text-align: center; }
.stepper .lbl { font-size: .85rem; color: var(--muted); padding-inline: .3rem; }

/* meals */
.meal { display: flex; flex-direction: column; gap: .5rem; }
.meal .kv { font-size: .93rem; }
.meal .kv b { color: var(--muted); font-weight: 500; }
.meal.open { border: 2px dashed var(--coral); }

/* checklist */
.check-section h3 { display: flex; align-items: center; gap: .5rem; }
.check-item {
  display: flex; gap: .8rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 14px;
  transition: background .2s; cursor: pointer;
}
.check-item:hover { background: var(--bg); }
.check-item input { margin-top: .2rem; }
.check-item .txt { flex: 1; }
.check-item.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--sage); }
.check-item .by { display: block; font-size: .8rem; color: var(--sage); text-decoration: none; }

/* expenses */
.stats { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }
.stat { background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat .n { font-size: 1.6rem; font-weight: 800; color: var(--teal); }
.stat .l { font-size: .9rem; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }
.pos { color: #c4553a; font-weight: 600; }
.neg { color: #2e8b57; font-weight: 600; }
.excluded td { opacity: .5; }
.transfer {
  display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; background: var(--sun-soft);
  border-radius: 14px; flex-wrap: wrap;
}
.transfer .arrow { font-size: 1.2rem; }
.transfer .amt { margin-inline-start: auto; font-weight: 800; font-size: 1.1rem; }

/* how it works */
.role { display: flex; gap: 1rem; align-items: flex-start; }
.role .ico {
  font-size: 1.8rem; width: 3.2rem; height: 3.2rem; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--sun-soft);
}
.formula { background: var(--teal-soft); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.formula code { background: #fff; padding: .1rem .5rem; border-radius: 8px; font-family: inherit; font-weight: 600; }

/* login */
.login-wrap { min-height: 60vh; display: grid; place-items: center; }
.login { max-width: 420px; width: 100%; text-align: center; }
.login .big { font-size: 3.5rem; }

.footer { text-align: center; color: var(--muted); padding: 1.5rem 1rem 2rem; font-size: .9rem; }
/* deploy update */
