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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

nav {
  background: #1a1a2e;
  color: white;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav h1 {
  font-size: 1.3rem;
}

.nav-links a {
  color: #ccc;
  text-decoration: none;
  margin-left: 1.5rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: white;
  background: #16213e;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

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

.header h2 {
  font-size: 1.5rem;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-primary {
  background: #4a90d9;
  color: white;
}

.btn-primary:hover {
  background: #357abd;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.day-badge {
  background: #4a90d9;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.date {
  color: #888;
  font-size: 0.9rem;
}

.card-location {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  display: inline;
}

.card-location-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.maps-link {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.4rem;
  background: #e8f0fe;
  border-radius: 4px;
  transition: all 0.2s;
}

.maps-link:hover {
  background: #d2e3fc;
}

.card-attachment {
  margin-top: 0.5rem;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s;
}

.attachment-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.card-custom-locations {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.custom-map-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  background: linear-gradient(135deg, #34a853 0%, #0f9d58 100%);
  color: white;
  border-radius: 16px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.2s;
}

.custom-map-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(52, 168, 83, 0.4);
}

.card-attachments {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.attachment-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.2s;
}

.attachment-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

.card-activity {
  color: #555;
  margin-bottom: 0.3rem;
}

.card-driving {
  background: #f0f0f0;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

.card-accommodation {
  background: #fff3e0;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #e65100;
  margin-top: 0.5rem;
}

.card-guide {
  background: #e8f5e9;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #2e7d32;
  margin-top: 0.5rem;
}

.card-recommend {
  background: #fff8e1;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #f57f17;
  margin-top: 0.5rem;
}

.card-notes {
  background: #f0f7ff;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #2a5a8a;
  margin-top: 0.5rem;
}

.card-backup {
  background: #fff8e6;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #8a6a2a;
  margin-top: 0.5rem;
}

.card-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.card-actions button {
  padding: 0.4rem 0.8rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.card-actions button.danger {
  color: #d9534f;
  border-color: #d9534f;
}

.card-actions button.danger:hover {
  background: #d9534f;
  color: white;
}

/* Expense Cards */
.expense-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: grid;
  grid-template-columns: 100px 80px 120px 70px 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.expense-date {
  color: #666;
  font-size: 0.9rem;
}

.expense-category {
  font-weight: 600;
  color: #4a90d9;
}

.expense-amount {
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
}

.expense-paidby {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: center;
}

.expense-paidby.小肉 {
  background: #e3f2fd;
  color: #1565c0;
}

.expense-paidby.小妞 {
  background: #fce4ec;
  color: #c2185b;
}

.expense-desc {
  color: #666;
  font-size: 0.9rem;
}

.expense-actions {
  display: flex;
  gap: 0.5rem;
}

.expense-actions button {
  padding: 0.3rem 0.6rem;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.expense-actions button.danger {
  color: #d9534f;
  border-color: #d9534f;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-label {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
}

/* Category Summary */
.category-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.category-item {
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  display: flex;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.category-name {
  color: #666;
}

.category-amount {
  font-weight: 600;
  color: #4a90d9;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
  color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

.form-group textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Loading & Empty */
.loading,
.empty {
  text-align: center;
  padding: 2rem;
  color: #888;
}

/* Responsive */
@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .expense-card {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }

  .expense-date {
    grid-column: 1;
  }

  .expense-category {
    grid-column: 2;
    text-align: right;
  }

  .expense-amount {
    grid-column: 1;
  }

  .expense-paidby {
    grid-column: 2;
    text-align: right;
  }

  .expense-desc {
    grid-column: 1 / -1;
  }

  .expense-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
