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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.5rem;
  color: #2e7d32;
  padding: 20px 0 16px;
  border-bottom: 2px solid #2e7d32;
  margin-bottom: 20px;
}

h2 {
  font-size: 1rem;
  color: #555;
  margin-bottom: 12px;
}

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group:first-child {
  grid-column: 1 / -1;
}

label {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

.required {
  color: #e53935;
}

input[type="text"],
input[type="number"],
input[type="date"] {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: #2e7d32;
}

.btn-primary {
  background: #2e7d32;
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1b5e20;
}

/* サマリー */
.summary-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.summary-card {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.summary-label {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2e7d32;
}

/* 一覧 */
.list-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-message {
  color: #aaa;
  text-align: center;
  padding: 32px 0;
  font-size: 0.9rem;
  line-height: 1.8;
}

.event-card {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 14px;
  position: relative;
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.event-name {
  font-weight: 700;
  font-size: 1rem;
}

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

.event-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.stat-item {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.stat-label {
  font-size: 0.7rem;
  color: #888;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
}

.stat-value.profit-plus {
  color: #2e7d32;
}

.stat-value.profit-minus {
  color: #c62828;
}

.event-extra {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.event-memo {
  font-size: 0.8rem;
  color: #777;
  margin-top: 6px;
  grid-column: 1 / -1;
}

.btn-delete {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}

.btn-delete:hover {
  color: #e53935;
}

/* 利益ランク */
.rank-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.rank-excellent {
  background: #e8f5e9;
  color: #2e7d32;
}

.rank-good {
  background: #e3f2fd;
  color: #1565c0;
}

.rank-break-even {
  background: #fff8e1;
  color: #f57f17;
}

.rank-loss {
  background: #ffebee;
  color: #c62828;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group:first-child {
    grid-column: 1;
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .event-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
