@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --surface: #ffffff;
  --surface-dark: #f4f5ff;
  --surface-strong: #ece7ff;
  --text: #0f172a;
  --muted: #4b5563;
  --primary: #6d4cff;
  --primary-dark: #4327c2;
  --accent: #ffb347;
  --border: rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  margin: 0;
  background: radial-gradient(circle at 10% 20%, rgba(109, 76, 255, 0.18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(250, 130, 49, 0.18), transparent 35%),
    var(--surface);
  min-height: 100vh;
  color: var(--text);
}

main,
header,
footer {
  width: min(1024px, 100%);
  margin-inline: auto;
}

.hero {
  display: flex;
  flex-direction: column;
  padding: 2rem 1rem 0;
  gap: 0.75rem;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.hero-title {
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  margin: 0.3rem 0;
}

.eyebrow {
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}

.lead {
  color: var(--muted);
  max-width: 520px;
}

.hero-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.menu-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.menu-btn span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
}

.install-btn {
  padding: 0.65rem 1.4rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(109, 76, 255, 0.4);
}

.ios-hint {
  color: var(--primary-dark);
  font-size: 0.85rem;
  margin: 0;
}

.app-shell {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 3rem;
}

.panel {
  background: var(--surface);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.panel.hidden {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-actions,
.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-card input,
.form-card select,
.form-card textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 1rem;
}

.form-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--muted);
}

.primary-btn,
.ghost-btn {
  border-radius: 12px;
  padding: 0.65rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.primary-btn {
  background: var(--primary);
  color: white;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.small {
  padding-inline: 0.9rem;
  padding-block: 0.55rem;
  font-size: 0.9rem;
}

.status-panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.status-badge {
  display: inline-flex;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(109, 76, 255, 0.15);
  color: var(--primary-dark);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.status-label {
  margin: 0.45rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.list-grid {
  display: grid;
  gap: 1rem;
}

.tab-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.tab-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tab-button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.tab-content {
  margin-top: 1rem;
}

.tab-content.hidden {
  display: none;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.overview-card {
  text-align: left;
}

.overview-card .amount {
  font-size: 1.8rem;
}

.members-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.member-row {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-strong);
}

.member-row .name {
  font-weight: 600;
}

.member-row .role {
  color: var(--muted);
  font-size: 0.85rem;
}

.member-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  background: rgba(109, 76, 255, 0.1);
  color: var(--primary-dark);
}

.group-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: var(--surface-dark);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.group-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.detail-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  background: var(--surface-strong);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.amount {
  font-size: 2rem;
  margin: 0;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 1rem;
  background: white;
}

.timeline-card h4 {
  margin: 0;
  font-size: 1rem;
}

.timeline-card p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.settlement {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settlement-row {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-dark);
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.feedback {
  color: var(--primary);
  min-height: 1.25rem;
  font-size: 0.9rem;
}

.info-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}

.info-card h4 {
  margin-bottom: 0.25rem;
  margin-top: 1rem;
  color: var(--primary-dark);
}

.info-card p {
  color: var(--muted);
  line-height: 1.5;
}

.info-card a {
  color: var(--primary);
}

.panel-sub {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.panel-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.detail-grid,
.timeline,
.settlement {
  width: 100%;
}

.group-card h3 {
  margin-bottom: 0.3rem;
}

.panel-sub p {
  margin: 0;
}

.hero-header {
  align-items: flex-start;
}

@media (max-width: 768px) {
  body {
    background: rgba(244, 245, 255, 0.95);
  }

  .hero {
    padding-top: 1.5rem;
  }

  .hero-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .hero-header-actions .install-btn {
    flex: 1;
  }

  .app-shell {
    padding: 0.75rem;
    gap: 0.85rem;
  }

  .panel {
    padding: 1.25rem;
    border-radius: 18px;
  }

  .status-panel {
    padding: 0.85rem;
  }

  .panel-header,
  .panel-actions,
  .panel-sub-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
  }

  #expensesFeed,
  #settlementList {
    gap: 0.65rem;
  }

  .timeline-card {
    padding: 0.85rem;
  }

  .menu-btn {
    width: 44px;
    height: 44px;
  }

  .info-card {
    padding: 1rem;
  }
}
