*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f5f5; --surface: #fff; --text: #1a1a1a; --muted: #666;
  --primary: #6366f1; --primary-hover: #4f46e5;
  --green: #22c55e; --red: #ef4444; --border: #e5e5e5;
  --radius: 12px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.container { max-width: 600px; margin: 0 auto; padding: 24px 16px; }
header { text-align: center; margin-bottom: 24px; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-header h2 { font-size: 1.1rem; font-weight: 600; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef2ff; color: var(--primary);
  padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 500;
}
.tag .remove { cursor: pointer; opacity: 0.6; font-size: 1.1rem; line-height: 1; }
.tag .remove:hover { opacity: 1; }

button, .btn, .btn-sm {
  cursor: pointer; border: none; border-radius: 8px; font-weight: 500;
  transition: background 0.15s;
}
button { background: var(--primary); color: #fff; padding: 10px 20px; font-size: 0.9rem; }
button:hover { background: var(--primary-hover); }
button.secondary { background: var(--border); color: var(--text); }
button.secondary:hover { background: #d4d4d4; }
.btn-sm { background: var(--primary); color: #fff; padding: 6px 14px; font-size: 0.8rem; }

.expense-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.expense-item:last-child { border-bottom: none; }
.expense-info { flex: 1; }
.expense-name { font-weight: 500; }
.expense-meta { font-size: 0.8rem; color: var(--muted); }
.expense-amount { font-weight: 600; font-size: 1rem; }
.expense-delete { cursor: pointer; color: var(--muted); margin-left: 12px; }
.expense-delete:hover { color: var(--red); }

.empty-hint { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 12px 0; }

.summary-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  font-size: 0.95rem;
}

#settlements { margin-top: 12px; }
.settlement {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 0; border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.settlement .arrow { color: var(--muted); }
.settlement .amount { font-weight: 600; }
.settlement .from { color: var(--red); }
.settlement .to { color: var(--green); }

.share-card { text-align: center; }
.share-status {
  margin-top: 8px; font-size: 0.85rem; color: var(--green);
  min-height: 1.3em;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; width: 90%; max-width: 380px; box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.modal h3 { margin-bottom: 16px; font-size: 1.1rem; }
.modal label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 4px; }
.modal input, .modal select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.9rem; margin-bottom: 12px; outline: none;
}
.modal input:focus, .modal select:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

.hidden { display: none !important; }

@media (max-width: 480px) {
  .container { padding: 16px 12px; }
  .card { padding: 16px; }
}
