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

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

/* ヘッダー */
.header {
  background: #4CAF50;
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* メインエリア */
.main {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* カード */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.step-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #333;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 20px;
  transition: opacity 0.2s, transform 0.1s;
  text-align: center;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-large {
  width: 100%;
  padding: 16px;
  font-size: 17px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
}

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

.btn-primary:hover:not(:disabled) {
  background: #43A047;
}

.btn-secondary {
  background: #2196F3;
  color: white;
  margin-top: 12px;
}

.btn-secondary:hover:not(:disabled) {
  background: #1E88E5;
}

.btn-ghost {
  background: #f0f0f0;
  color: #555;
}

.btn-ghost:hover:not(:disabled) {
  background: #e0e0e0;
}

/* ファイル入力 */
.hidden {
  display: none !important;
}

/* プレビュー */
.preview {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.preview img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

/* ローディング */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.loading p {
  font-size: 16px;
  color: #666;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border: 3px solid #e0e0e0;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.inline-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  color: #666;
  font-size: 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 解析結果フォーム */
.result-type-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.badge-food { background: #E8F5E9; color: #2E7D32; }
.badge-dining { background: #FFF3E0; color: #E65100; }

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.form-row label {
  font-size: 13px;
  color: #777;
  font-weight: 600;
}

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

.form-row input:focus {
  outline: none;
  border-color: #4CAF50;
}

.categories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.divider {
  border: none;
  border-top: 1px solid #eee;
  margin: 16px 0;
}

.totals-area {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.save-area {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-content h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-note {
  font-size: 13px;
  color: #888;
  margin-top: -8px;
}

.modal-content label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
}

.modal-content input {
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
}

.modal-content input:focus {
  outline: none;
  border-color: #4CAF50;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* トースト */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: opacity 0.3s;
  white-space: nowrap;
}

.toast.success { background: #4CAF50; }
.toast.error { background: #F44336; }
