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

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

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

h1 {
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin-bottom: 24px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.input-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.input-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.input-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px;
  transition: border-color 0.2s, background 0.2s;
}

.input-wrapper:focus-within {
  border-color: #667eea;
  background: white;
}

.input-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 18px;
  font-weight: 600;
  color: #667eea;
  background: white;
  border-radius: 8px;
  min-width: 45px;
}

.input-wrapper input,
.input-wrapper select {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  outline: none;
}

.input-wrapper select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23667eea' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-wrapper input::placeholder {
  color: #9ca3af;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: white;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab {
  flex: 1;
  padding: 12px 24px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #6b7280;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
}

.tab:hover {
  color: #2563eb;
  background: #f3f4f6;
}

.tab.active {
  color: white;
  background: #2563eb;
}

.section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid;
}

.section.past { border-left-color: #ef4444; }
.section.current { border-left-color: #f59e0b; }
.section.future { border-left-color: #10b981; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f3f4f6;
}

.section h3 {
  font-size: 18px;
  font-weight: 600;
}

.section.past h3 { color: #ef4444; }
.section.current h3 { color: #f59e0b; }
.section.future h3 { color: #10b981; }

.btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: white;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-add:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-add.past { background: #ef4444; }
.btn-add.current { background: #f59e0b; }
.btn-add.future { background: #10b981; }

.commitment-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.commitment-item {
  display: grid;
  grid-template-columns: 1fr 160px 100px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  transition: background 0.2s;
}

.commitment-item:hover {
  background: #f3f4f6;
}

.commitment-item.editing {
  background: #dbeafe;
  grid-template-columns: 1fr 160px 100px;
}

.commitment-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.commitment-name input {
  width: 100%;
  padding: 10px;
  border: 2px solid #3b82f6;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

.commitment-amount input {
  width: 100%;
  padding: 10px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s;
}

.commitment-amount input:focus {
  outline: none;
  border-color: #3b82f6;
}

.commitment-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.btn-icon {
  padding: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: white;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  transform: scale(1.1);
}

.btn-edit { background: #3b82f6; }
.btn-delete { background: #ef4444; }
.btn-save { background: #10b981; }
.btn-cancel { background: #6b7280; }

.total {
  border-top: 2px solid #e5e7eb;
  padding-top: 16px;
  margin-top: 16px;
  background: #f9fafb;
  padding: 20px;
  border-radius: 8px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.total-row:last-child {
  margin-bottom: 0;
  font-size: 16px;
}

.balance.positive { color: #10b981; }
.balance.negative { color: #ef4444; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card.past { border-left-color: #ef4444; }
.card.current { border-left-color: #f59e0b; }
.card.future { border-left-color: #10b981; }

.card-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.card.past .card-label { color: #ef4444; }
.card.current .card-label { color: #f59e0b; }
.card.future .card-label { color: #10b981; }

.card-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1f2937;
}

.card-text {
  font-size: 14px;
  color: #6b7280;
}

.card-divider {
  margin: 16px 0 0 0;
  padding-top: 16px;
  border-top: 2px solid #e5e7eb;
}

.info-box {
  background: #dbeafe;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  border-left: 4px solid #3b82f6;
}

.info-box.success {
  background: #dcfce7;
  border-left-color: #10b981;
}

.info-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1f2937;
}

.info-box p {
  font-size: 15px;
  line-height: 1.7;
  color: #374151;
}

.chart-container {
  background: white;
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-container h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #1f2937;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-block {
  width: 100%;
}

canvas {
  max-height: 400px;
}

.icon {
  width: 14px;
  height: 14px;
}

@media (max-width: 768px) {
  .input-grid {
    grid-template-columns: 1fr;
  }

  .commitment-item,
  .commitment-item.editing {
    grid-template-columns: 1fr;
  }
  
  .commitment-actions {
    justify-content: flex-start;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: column;
  }

  .tab {
    text-align: center;
  }
}

@media (max-width: 480px) {
  #app {
    padding: 12px;
  }

  header {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
    margin-bottom: 16px;
  }

  .input-card {
    padding: 16px;
  }

  .section {
    padding: 16px;
  }

  .chart-container {
    padding: 20px;
  }
}