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

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
}

.subtitle {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 4px;
  margin-bottom: 24px;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #334155;
}

/* フォームセクション */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

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

input:focus {
  outline: none;
  border-color: #2563eb;
}

/* プレビュー */
.preview {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.preview-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.preview-value {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.highlight-red .preview-value {
  color: #dc2626;
}

.highlight-blue .preview-value {
  color: #2563eb;
}

/* 追加ボタン */
.btn-add {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}

.btn-add:hover {
  background: #1d4ed8;
}

/* リストセクション */
.list-section {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.list-header h2 {
  margin-bottom: 0;
}

.summary {
  font-size: 0.9rem;
  color: #475569;
}

.summary strong {
  color: #dc2626;
  font-size: 1rem;
}

.empty-msg {
  text-align: center;
  color: #94a3b8;
  padding: 32px 0;
  font-size: 0.95rem;
}

/* テーブル */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 700px;
}

thead {
  background: #f1f5f9;
}

th {
  padding: 10px 10px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  border-bottom: 2px solid #e2e8f0;
}

td {
  padding: 10px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.td-increase {
  color: #dc2626;
  font-weight: 600;
}

.td-sell {
  color: #2563eb;
  font-weight: 600;
}

.btn-del {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-del:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* レスポンシブ */
@media (max-width: 480px) {
  h1 {
    font-size: 1.3rem;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .preview-grid {
    grid-template-columns: 1fr 1fr;
  }
}
