*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --border: #e2e0db;
  --primary: #2d6a4f;
  --primary-light: #52b788;
  --danger: #e63946;
  --text: #1a1a1a;
  --muted: #6b7280;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.navbar {
  background: var(--primary);
  padding: 0.75rem 1.5rem;
}
.nav-logo {
  height: 36px;
  width: auto;
  display: block;
}
.brand {
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.6rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.82rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card h2 { font-size: 1rem; margin-bottom: 0.75rem; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.section-header h2 { margin-bottom: 0; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

/* Trip list */
.trip-list { display: flex; flex-direction: column; gap: 0.75rem; }
.trip-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.trip-card:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.trip-card-name { font-weight: 700; font-size: 1.05rem; }
.trip-card-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }
.trip-card-desc { font-size: 0.88rem; color: var(--muted); margin-top: 0.3rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.form input, .form select, .form textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg);
  width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--primary-light);
  border-color: transparent;
}
.form textarea { min-height: 80px; resize: vertical; }

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.inline-form input {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  flex: 1;
  min-width: 80px;
}

/* Lists */
.member-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.member-list li { font-size: 0.92rem; }

.balance-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.balance-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}
.balance-list li:last-child { border-bottom: none; }
.positive { color: var(--primary); }
.negative { color: var(--danger); }

/* Expense table */
.expense-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.expense-table th { text-align: left; padding: 0.5rem 0.75rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--border); }
.expense-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
.expense-table tr:last-child td { border-bottom: none; }

.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: capitalize;
}

/* Settlements */
.settlement-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.settlement-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}
.from { font-weight: 600; }
.arrow { color: var(--muted); }
.to { font-weight: 600; color: var(--primary); }
.amount { margin-left: auto; font-weight: 700; }

/* Home page */
.home-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
}
.home-hero h1 { font-size: 2rem; line-height: 1.25; }
.hero-sub { color: var(--muted); margin-top: 0.6rem; font-size: 0.95rem; }

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 700px;
  margin: 0 auto;
}
@media (max-width: 600px) { .home-actions { grid-template-columns: 1fr; } }

.btn-full { display: block; text-align: center; width: 100%; margin-top: 1rem; }

.join-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0; }
.join-form input {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg);
  width: 100%;
}
.join-form input:focus { outline: 2px solid var(--primary-light); border-color: transparent; }

.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }

/* Invite link */
.invite-card { background: #f0faf4; border-color: #b7e4c7; }
.invite-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.invite-row input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: white;
  color: var(--muted);
}
.copy-confirm { font-size: 0.82rem; color: var(--primary); margin-top: 0.35rem; display: inline-block; }

/* Misc */
.muted { color: var(--muted); font-size: 0.88rem; }
.trip-desc { color: var(--muted); margin-bottom: 1.25rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state .btn { margin-top: 1rem; }
