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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f5f5;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.container {
  background: white;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header {
  margin-bottom: 32px;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 24px;
}

h1 {
  font-size: 28px;
  color: #333;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: #666;
}

.disclaimer {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 16px;
  margin-bottom: 24px;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
  line-height: 1.6;
}

.usage-notice {
  background: #e8f4f8;
  border-left: 4px solid #17a2b8;
  padding: 16px;
  margin-bottom: 24px;
  border-radius: 4px;
  font-size: 13px;
  color: #333;
  line-height: 1.6;
}

.usage-notice summary {
  cursor: pointer;
  font-weight: 500;
  color: #17a2b8;
}

.usage-notice summary:hover {
  text-decoration: underline;
}

.usage-notice p {
  margin: 12px 0 8px 0;
}

.usage-notice label {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  cursor: pointer;
}

.usage-notice input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

.form-section {
  margin-bottom: 32px;
}

.form-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #333;
}

.source-count-selector {
  margin-bottom: 24px;
}

.source-count-selector label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

#sourceCount {
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 100%;
  max-width: 200px;
}

.income-sources {
  margin-bottom: 24px;
}

.source-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .source-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

@media (max-width: 390px) {
  .source-row {
    grid-template-columns: 1fr;
  }
}

.source-row input,
.source-row select {
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.source-row label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.authorization-status {
  padding: 16px;
  background: #f9f9f9;
  border-radius: 4px;
  margin-bottom: 24px;
}

.authorization-status h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: #333;
}

.authorization-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.authorization-checkbox input {
  width: 18px;
  height: 18px;
}

.authorization-checkbox label {
  flex: 1;
  cursor: pointer;
  color: #333;
}

#alreadyAuthorized {
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 100%;
  max-width: 200px;
}

.button-group {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

button {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 48px;
}

#calculateBtn {
  background: #0066cc;
  color: white;
  flex: 1;
}

#calculateBtn:hover:not(:disabled) {
  background: #0052a3;
}

#calculateBtn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#resetBtn {
  background: #e0e0e0;
  color: #333;
  flex: 1;
}

#resetBtn:hover {
  background: #d0d0d0;
}

#backBtn {
  background: #e0e0e0;
  color: #333;
  flex: 1;
}

#backBtn:hover {
  background: #d0d0d0;
}

#getFullVersionBtn {
  background: #d32f2f;
  color: white;
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  padding: 16px 24px;
}

#getFullVersionBtn:hover {
  background: #b71c1c;
}

.result-section {
  margin-top: 32px;
}

.result-section h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #333;
}

.decision-panel {
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 24px;
  border-left: 4px solid #999;
}

.decision-panel.green {
  background: #e8f5e9;
  border-left-color: #4caf50;
}

.decision-panel.red {
  background: #ffebee;
  border-left-color: #f44336;
}

.decision-panel.gray {
  background: #f5f5f5;
  border-left-color: #999;
}

.decision-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.citation {
  font-size: 13px;
  color: #666;
  margin-top: 8px;
  font-style: italic;
}

.confidence {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
}

#costSection {
  background: #fff9e6;
  padding: 16px;
  border-radius: 4px;
  margin: 16px 0;
  border-left: 3px solid #ff9800;
}

#costSection.hidden {
  display: none;
}

.cost-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #ffe6cc;
}

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

.cost-label {
  color: #666;
}

.cost-value {
  font-weight: 600;
  font-family: 'Courier New', monospace;
  color: #333;
}

#fixStepsSection {
  background: #f0f7ff;
  padding: 16px;
  border-radius: 4px;
  border-left: 3px solid #0066cc;
}

#fixStepsSection.hidden {
  display: none;
}

#fixStepsSection h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #333;
}

.fix-step {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d1e7f7;
}

.fix-step:last-child {
  border-bottom: none;
}

.fix-step-number {
  font-weight: 600;
  color: #0066cc;
  margin-right: 8px;
}

.fix-step-action {
  color: #333;
  margin-bottom: 4px;
}

.fix-step-decree {
  font-size: 12px;
  color: #666;
  font-style: italic;
}

.hidden {
  display: none !important;
}

.message {
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
}

.error-message {
  background: #ffebee;
  border-left: 3px solid #f44336;
  color: #c62828;
}

.full-version-section {
  background: #fff3e0;
  border: 2px solid #d32f2f;
  border-radius: 8px;
  padding: 24px;
  margin: 24px 0;
  text-align: center;
}

.full-version-section h3 {
  font-size: 18px;
  color: #d32f2f;
  margin-bottom: 12px;
  font-weight: 600;
}

.full-version-section p {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  .source-row {
    grid-template-columns: 1fr 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  #getFullVersionBtn {
    font-size: 16px;
  }
}

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

  h1 {
    font-size: 22px;
  }

  .source-row {
    grid-template-columns: 1fr;
  }

  .full-version-section {
    padding: 16px;
  }

  .full-version-section h3 {
    font-size: 16px;
  }
}
