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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #1a1a2e;
  min-height: 100vh;
}

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

/* Header */
header {
  background: #6c63ff;
  color: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.total-box {
  text-align: right;
}

.total-label {
  display: block;
  font-size: 0.75rem;
  opacity: 0.85;
}

.total-amount {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
}

/* Sections */
.form-section,
.list-section {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.form-section h2,
.list-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: #444;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #6c63ff;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.btn-add {
  width: 100%;
  padding: 12px;
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}

.btn-add:hover {
  background: #5a52d5;
}

.btn-add:active {
  transform: scale(0.98);
}

/* List */
.list-section h2 .count {
  font-size: 0.8rem;
  font-weight: 400;
  color: #999;
  margin-left: 6px;
}

.empty-msg {
  text-align: center;
  color: #bbb;
  font-size: 0.9rem;
  padding: 20px 0;
}

.sub-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.sub-item:last-child {
  border-bottom: none;
}

.sub-info {
  flex: 1;
  min-width: 0;
}

.sub-name {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-renewal {
  font-size: 0.78rem;
  color: #999;
  margin-top: 2px;
}

.sub-renewal.near {
  color: #e07b00;
  font-weight: 600;
}

.sub-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: #6c63ff;
  margin-right: 12px;
  white-space: nowrap;
}

.btn-delete {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

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

@media (max-width: 400px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .total-box {
    text-align: left;
  }
}
