:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f4f6;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.topbar {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.topbar nav {
  display: flex;
  gap: 1rem;
}

.topbar nav a {
  text-decoration: none;
  color: #374151;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.topbar nav a#home-link {
  margin-left: auto;
  color: #6b7280;
  font-size: 0.8rem;
}

.topbar nav a.active {
  background: #111827;
  color: #fff;
}

main {
  flex: 1;
  padding: 1rem;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1rem;
}

.hint {
  font-size: 0.8rem;
  color: #6b7280;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

form input,
form select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.inline-form input,
.inline-form select {
  flex: 1;
  min-width: 100px;
}

button {
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.link-btn {
  background: none;
  color: #b91c1c;
  padding: 0;
  font-size: 0.75rem;
  text-decoration: underline;
}

.ok {
  color: #15803d;
  font-size: 0.85rem;
}

.warn {
  color: #b45309;
  font-size: 0.85rem;
}

.participant-list,
.expense-list,
.balance-list,
.settlement-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.expense-list li {
  border-top: 1px solid #f3f4f6;
  padding: 0.5rem 0;
}

.shares {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.balance-list li {
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.balance-list li.positive strong {
  color: #15803d;
}

.balance-list li.negative strong {
  color: #b91c1c;
}

.total {
  font-size: 0.85rem;
  font-weight: 600;
}

.total.warn {
  color: #b45309;
}

.privacy-note {
  text-align: center;
  font-size: 0.7rem;
  color: #9ca3af;
  padding: 0.75rem;
}

.about-seo details {
  margin-top: 0.5rem;
}

.about-seo summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0;
}

.about-seo .hint {
  margin: 0.25rem 0 0.5rem;
}

.hub-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.hub-card-icon {
  font-size: 1.6rem;
}

.hub-card strong {
  display: block;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  font-size: 0.75rem;
  padding: 0 0.75rem 1rem;
}

.site-footer a {
  color: inherit;
  opacity: 0.75;
  text-decoration: none;
}

.site-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

.site-footer .separator {
  opacity: 0.4;
  margin: 0 0.35rem;
}

.whatsapp-btn {
  background: #25d366;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.groups-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.groups-list li a {
  display: block;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.9rem;
}

.expense-list li.settled {
  opacity: 0.55;
}

.expense-list li.settled strong {
  text-decoration: line-through;
}

.settled-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.onboarding ul {
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.onboarding li {
  margin-bottom: 0.5rem;
}

.cookie-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  justify-content: center;
}

.cookie-content {
  background: #111827;
  color: #f9fafb;
  border-radius: 12px;
  padding: 1rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.cookie-content p {
  font-size: 0.8rem;
  margin: 0 0 0.75rem;
}

.cookie-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cookie-actions a {
  color: #9ca3af;
  font-size: 0.75rem;
}

.cookie-actions button {
  background: #25d366;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e5e7eb;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #6b7280;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.avatar-row .avatar {
  width: 56px;
  height: 56px;
  font-size: 1.3rem;
}

.avatar-upload-label {
  display: inline-block;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-summary div {
  display: flex;
  flex-direction: column;
  margin-right: auto;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #0b0f19;
  }
  .app-shell {
    background: #111827;
  }
  .topbar {
    border-color: #1f2937;
  }
  .topbar nav a {
    color: #d1d5db;
  }
  .card {
    background: #1a2233;
    border-color: #1f2937;
  }
  form input,
  form select {
    background: #0b0f19;
    border-color: #374151;
    color: #f9fafb;
  }
  .groups-list li a {
    border-color: #1f2937;
  }
  .avatar {
    background: #374151;
  }
  .avatar-placeholder {
    color: #d1d5db;
  }
}
